HiveBrain v1.2.0
Get Started
← Back to all entries
snippetdockerMinor

How do I automate deployments with Kubernetes?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
withkubernetesautomatedeploymentshow

Problem

Assuming I have Kubernetes deployed via Rancher and Jenkins is building new images and pushing them to DockerHub upon check-in of new code to GitHub, how do I automate getting new images deployed?

Another way to ask the question might be, “I used to use Octopus to manage my deployments. Is there something similar built in to Kubernetes or Rancher?” Ultimately, it’s this last gap that I’m struggling with.

Solution

As of you are using Rancher the easiest way would be to register custom Rancher Catalog and create an item for each stack/service you want to deploy.

Rancher Catalog is a Git repository with the following structure

Then in Jenkins you can create a job that would call Rancher REST API to deploy/update stack/service.

In its turn Rancher would pull latest version of the Docker image for this service and deploy it corresponding to Docker Compose file from the catalog.

Pros:

  • generic approach that might be used for almost every app



  • Jenkins itself might be deployed into Rancher environment, agents might be created in Kubernetes cluster



Cons:

  • development team should follow solid release strategy to be able to use generic builds



  • storage drivers are still under the question in alpha release of Rancher 2.0

Context

StackExchange DevOps Q#2843, answer score: 4

Revisions (0)

No revisions yet.