idanshahar / K8SCodeComponentsMeetup

Kubernetes Code Component Meetup on February 13th, 2018 @Microsoft Starthub TLV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kubernetes Code Components Meetup

Presentation

Kubernetes Code Components

Prerequisites

  1. A running Kubernetes Cluster - AKS Instructions
  2. Helm - Installation Instructions
  3. Draft - Installation Instructions
  4. kubectl - Installation Instructions
  5. Docker - Installation Instructions

Nodeless Jenkins on Kubernetes

Set up Jenkins using helm

asciicast

# if this is the first time you are using helm, please uncomment the line below.

# helm init

helm install --name jenkins stable/jenkins

# Alternatively, if you are having issues with the persistant volume class, you can still install jenkins from the chart provided in this repo:
# helm install --name jenkins jenkins-helm/.
# or to pass the storage class parameter:
helm install --name jenkins stable/jenkins --set Persistence.StorageClass=default

# the provided chart also Adds ACI plugin and Azure AD plugin (needs to be configured though)

Get Jenkins admin password

printf $(kubectl get secret --namespace default jenkins-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo

Build a Docker Image for Jenkins Slave on your own

git clone https://github.com/idanshahar/K8SCodeComponentsMeetup.git

cd KubernetesCodeComponents/jenkins

docker build . --tag ${YOUR_DOCKER_REGISTRY}:${TAG}

docker push ${YOUR_DOCKER_REGISTRY}:${TAG}

Jenkins Configuration

Go to "Manage Jenkins" -> "Configure System"

  1. Under Container Template, change the Docker Image to: idanshahar/jenkins-slave:latest
  2. Add the following host path volumes: /var/run/docker.sock, /usr/bin/docker
  3. Create a new Pipeline job and select the jenkins file from git
  4. Change kubernetes url to 10.0.0.1

Go to "Credentials" -> "System" -> "Global credentials" -> "Add Credentials"

  1. Choose "Global" Scope
  2. Add your Dockerhub credentials
  3. Insert 'docker-hub-credentials' as the credentialls ID

Containerize applications using Draft

# cd to your app root folder
cd node-draft

draft init #initialize draft

draft create 

draft up

Monitoring

Official Kubernetes Metrics Project

Implementations

  1. Heapster
  2. Metrics Server
  3. Prometheus Adapter
  4. Google Stackdriver (coming soon)

About

Kubernetes Code Component Meetup on February 13th, 2018 @Microsoft Starthub TLV


Languages

Language:Smarty 39.0%Language:Groovy 33.2%Language:JavaScript 22.3%Language:Shell 5.5%