This article is about Codeship Pro.

Deploying With Kubernetes

You will need roughly 2 minutes to read this article.

Integrating Codeship with Kubernetes

To use Kubernetes with Codeship Pro, you will need to define a deployment container in your codeship-services.yml file with the kubectl tool installed.

You can then use that service to run any kubectl commands you need via your codeship-steps.yml file, as well as to authenticate with your production service.

Since many Kubernetes users are using a managed platform, such as Google, AWS or Azure we also have deployment containers pre-built to simplify this process.


Inside your codeship-services.yml file, you will need to define a new service with the kubectl tool installed. For example:

  build: ./
  cached: true

This service will need a Dockerfile, or an existing base image, that installs the tool and authenticates you either via environment variables or via hardcoded login credentials. The Dockerfile would look something like this, as a simple example:

FROM alpine:3.6

# Install kubectl
# Note: Latest version may be found on:
ADD /usr/local/bin/kubectl
RUN chmod u+x /usr/local/bin/kubectl

RUN chmod u+x


Once you have your service defined, you will use your codeship-steps.yml file to run the necessary kubectl commands. In this case, we will put those commands into a new script file named

- name: deploy
  service: kubernetes-deployment
  command: ./

Inside this script file can be any kubectl commands you would like, for instance invoking a new Kubernetes deployment from a configuration file:


kubectl apply -f ./deployment.yaml

Essentially, now that you have a container with the kubectl tool, you will script your deployments in any way you’d like to use that command line tool in the workflow you define.

Managed Services

For managed services, we have prebuilt deployment containers to simplify then authentication and deployment process and to make use of each provider’s individual CLI.

Need more help?

You can post on Stack Overflow using the tag #codeship or contact our Helpdesk.
We also have a couple of code examples and sample projects available for you to get started with.

Was This Article Helpful?

Do you think we need to improve this article? If so, please submit our feedback form to help us improve this article!