Jenkins plugin to deploy a docker image into a k8s cluster?

6/21/2017

I have been looking for a jenkins plugin to deploy a docker image to a kubernetes cluster using k8s api. This will access the rest api with yaml file with credentials that already configured. If there is no similar plugin, you can let me know other simple examples. Thanks for reading.

-- verystrongjoe
jenkins-plugins
kubernetes

2 Answers

6/21/2017
-- chaitu kopparthi
Source: StackOverflow

6/21/2017

I'm using a simple Execute Shellstep in Jenkins with the fallowing command:

kubectl --server="https://kubeapi.example.com"  --token=$ACCESS_TOKEN set image deployment/deployment_name container_name=repo/image:"$BUILD_NUMBER-$SHORT_GIT_COMMIT"

You can save your $ACCESS_TOKENas a Secret text and use it as a variable in Jenkins.

The job is making the build, tag and publish a docker image to docker repo, then set the image in the kubernetes cluster.

-- Camil
Source: StackOverflow