Set up Jenkins,Docker, Kubernetes ci/cd on Azure

4/25/2018

I want to create a CI/CD on Azure with Jenkins, Docker, Kubernetes, starting from simple.

I already went through the Voting-app tutorial Tutorial: Prepare application for Azure Container Service (AKS) Azure tutorial The tutorial covers the steps:

1 - Prepare application for AKS 2 - Create container registry ACS 3 -Create Kubernetes cluster 4 - Run application

The application is working.

The next step I want to do, is to integrate Jenkins. I am following the tutorial Continuous deployment with Jenkins and Azure Container Service I couldn´t follow the tutorial because is too advanced to understand the commands from the files. For example, the way they deployed jenkins using the file deploy-jenkins-vm.sh

Instead of that, I went to the Marketplace on Azure and created "Jenkins" and via the Azure UI, set up the configuration. Jenkins is now running on localhost:8080

From another video tutorial Hands-on Docker, Jenkins CI/CD Azure I shared the cluster kubeconfig to my remote jenkins host:

$ sudo scp ~/.kube/config anjenkins@jenkins9999.australiaeast.cloudapp.azure.com:/var/lib/jenkins/config

It worked.

Then, from the same video tutorial they run a bash file

#!/bin/bash
# Jenkins Bootstrap for ACS Kubernetes
set -x #echo on
wget https://raw.githubusercontent.com/mekenthompson/kubectl/master/kubectl -O ~/kubectl
chmod +x kubectl
sudo cp kubectl /usr/local/bin/kubectl
sudo mkdir /home/tomcat/.kube
sudo cp config /home/tomcat/.kube/config
sudo chown -R tomcat:tomcat /home/tomcat/.kube
sudo usermod -aG docker tomcat
sudo /opt/bitnami/ctlscript.sh restart
set +x #echo off

From the repository here. It didn´t work for me

+ chmod +x kubectl
+ sudo cp kubectl /usr/local/bin/kubectl
+ sudo mkdir /home/tomcat/.kube
mkdir: cannot create directory '/home/tomcat/.kube': No such file or directory
+ sudo cp config /home/tomcat/.kube/config
cp: cannot stat 'config': No such file or directory
+ sudo chown -R tomcat:tomcat /home/tomcat/.kube
chown: invalid user: 'tomcat:tomcat'
+ sudo usermod -aG docker tomcat
usermod: group 'docker' does not exist
+ sudo /opt/bitnami/ctlscript.sh restart
sudo: /opt/bitnami/ctlscript.sh: command not found
+ set +x

But my question is, what is the next step after I shared de kubeconfig to my jenkins remote host. I am just copying and pasting, but not knowing , what is happening

Form the tutorials, they seem to me, too advanced and I don´t know what is going on, or what exactly should be done.

From the Azure Voting tutorial they have another file, to set up Jenkins config-jenkins.sh, but as well I don´t know what needs to be done

What exactly I should do, Do you know other resources or links to follow.

I have already jenkins, an Azure Container Registry, Azure Container Service, and the voting app.

-- andreahg
azure
docker
jenkins
kubernetes

1 Answer

5/22/2018

We're working on an open source project called Jenkins X which is a proposed sub project of the Jenkins foundation aimed at automating CI/CD on Kubernetes using Jenkins pipelines and GitOps for promotion across environments.

If you want to see how to automate CI/CD with multiple environments on Kubernetes using GitOps for promotion between environments and Preview Environments on Pull Requests you might wanna check out my recent talk on Jenkins X at DevOxx UK where I do a live demo of this on GKE. Though Jenkins X works on AWS, AKS and GKE and other kubernetes clusters too.

-- James Strachan
Source: StackOverflow