Skip to content

Create a client instance in code running in docker container #933

Answered by nightkr
ScottLinnn asked this question in Q&A
Discussion options

You must be logged in to vote

You typically don't want to bake the kubeconfig file into your image, since it will vary for each environment, and often contains some sort of credentials.

Instead, you have three other options:

  1. Add a Docker volume that mounts ~/.kube into the container (see https://docs.docker.com/compose/gettingstarted/#step-5-edit-the-compose-file-to-add-a-bind-mount for how to do this)
    • This will probably not work (without additional research) if your cluster uses some external form of authentication (like GCP's OAuth, or a plugin), since those credentials will be stored elsewhere
  2. Run it in Kubernetes instead, tools like https://tilt.dev/ help give a similar DX as docker-compose once set up
    • All Ku…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ScottLinnn
Comment options

Answer selected by ScottLinnn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants