Skip to content

Docker image for issuing kubectl commands in Codeship Pro build

License

Notifications You must be signed in to change notification settings

codeship-library/kubectl

Folders and files

NameName
Last commit message
Last commit date
Jul 10, 2018
Jul 10, 2018
Aug 15, 2018
Jul 9, 2018
Jul 22, 2019
Aug 15, 2018
Aug 15, 2018
Jul 22, 2019
Jul 10, 2018
Jul 10, 2018
Jul 10, 2018

Repository files navigation

codeship/kubectl container

kubectl binary container, with guidance for configuring credentials (including secrets) to issue commands to your cluster from a Codeship Pro step.

Distill your k8s configurations to single file

kubectl config view --flatten > kubeconfigdata # add --minify flag to reduce info to current context

Copy contents to env var file using our codeship/env-var-helper container

docker run --rm -it -v $(pwd):/files codeship/env-var-helper cp kubeconfigdata:/root/.kube/config k8s-env

Check out the codeship/env-var-helper README for more information.

Encrypt the file, remove files and/or add to .gitignore

jet encrypt k8s-env k8s-env.encrypted
rm kubeconfigdata k8s-env

Configure the service and steps into the build with the following as guidance

# codeship-services.yml

kubectl:
  image: codeship/kubectl
  encrypted_env_file: k8s-env.encrypted
# codeship-steps.yml

- name: check response to kubectl config
  service: kubectl
  command: kubectl config view

Deploying to EKS?

The same workflow outline above works with EKS, but use the codeship/eks-kubectl image, which comes installed with aws-iam-authenticator and an AWS-vendored copy of kubectl.