Our most popular Steps for interacting with Kubernetes clusters

Wercker is a Docker-Native CI/CD Automation platform for Kubernetes & Microservice Deployments

Aaron Rice
Aaron Rice
November 7, 2016

The Wercker Steps Registry contains a plethora of useful Steps that carry out automation tasks in your Pipelines. Our most popular steps for integrating directly with Kubernetes include:

Kubectl

The Wercker-submitted Kubectl Step is the most powerful Step for integrating directly with Kubernetes. It allows you use the Kubernetes kubectl tool directly from your Wercker Pipelines, with support for clusters launched on Google Container Engine, Google Compute Engine, Amazon EC2, or in your own datacenter.

For example:

deploy:
steps:
- kubectl:
server: $GKE_KUBERNETES_MASTER
username: $GKE_KUBERNETES_USERNAME
password: $GKE_KUBERNETES_PASSWORD
command: create -f my-python-app-deployment.json

This example would have used the kubectl tool to create a new deployment for your Wordpress application on your Kubernetes Cluster, in the above example hosted on Google Container Engine.

Kube-deploy

The kube-deploy step is a community-submitted Step used for updating Kubernetes deployments. Its features include:

  • Replacing Kubernetes deployment image tags via rolling updates
  • Monitoring deploys for success
  • Rolling back deploys

For example:

deploy:
steps:
- morriz/step-kube-deploy:
verbose: true
debug: true
server: $KUBE_MASTER_PROD
deployment: my-python-app
tag: $WERCKER_GIT_COMMIT

This example forms a deploy pipeline that would update the Kubernetes deployment for example Python application that already exists on a given Kubernetes cluster.

Wercker automatically sets the $WERCKER_GIT_COMMIT environment variable, and the others would be defined by you on Wercker Web.

Ktmpl

The Ktmpl Step is a community-submitted Step for creating Kubernetes configuration files using the open-source ktmpl tool. These templates can then be submitted to a Kubernetes cluster using the kubectl step, or similar.

An example of its use would be:

deploy:
steps:
- blendle/ktmpl:
template: template.yml
output: deployment.yml
parameters: REPLICA_COUNT=2 APP_NAME="my-python-application" DOCKER_IMAGE_PATH="hub.docker.com/my-python-application:$WERCKER_GIT_COMMIT"
debug: true

This would create a new Kubernetes deployment YAML file containing this run's git commit, which is automatically set to an environment variable, along with some deployment information such as the desired Kubernetes pod replica count, and Kubernetes application name.

An alternate step for ktmpl would be the bash-template Step which uses environment variables for expanding templates.

Create your own

The above examples are just a tiny snapshot of the most popular Wercker Steps for interacting with Kubernetes clusters.

Check out the Steps Registry for the full directory, and if we happen to be missing a Step that performs an action you require, you can use our Steps documentation to write and submit it back to the community!

Like Wercker?

Why not join our early access club. We’ll invite you to try our beta products and treat you nice.

As usual, if you want to stay in the loop follow us on twitter @wercker or hop on our public slack channel. If it’s your first time using Wercker, be sure to tweet out your #greenbuilds, and we’ll send you some swag!

Topics: Kubernetes, Containers, Integrations, Steps