Skip to main content

Posts

Showing posts from August, 2015

Dynamically add Jenkins slaves using Kubernetes

CI is a very interesting area where Kubernetes can be applied. It's a common use case to have a demand of containers to be able to run tests of code changes, or to create some build artifacts. In this post I will be explaining how to use Kubernetes to spin up Jenkins slaves and connect them to a Jenkins master, allowing to run tests on demand, and have a very easy and fast way to scale depending on our needs. Pre-requisites needed on Jenkins master Installing Jenkins plugin This approach relies on Jenkins Swarm Plugin. So you need to ensure that you have installed this module on your master: https://wiki.jenkins-ci.org/display/JENKINS/Swarm+Plugin For Jenkins Swarm Plugin to work, you need to enable CSRF. You need to visit http://url.to.master/configureSecurity/ and check the Prevent Cross Site Request Forgery exploits option. Configure security Also consider that Jenkins uses a random port to enable connection to slaves using JNLP. If you are under a protected e

Integration of Kubernetes + OpenStack using Ansible

Kubernetes 1.0 has been lately released - it was announced at  OSCON on July 21st. As an OpenStack user, and regular OpenStack infra contributor, I can see a high value on Kubernetes + OpenStack integration. For that reason, I started a project, based on  https://github.com/GoogleCloudPlatform/kubernetes/tree/master/contrib/ansible , to automate a Kubernetes cluster using OpenStack (used HP Cloud as a sample). In this post, I will be describing the steps needed to deploy a whole Kubernetes cluster in few steps. All source files used are stored on https://github.com/kubestack/kubestack . Before starting So, what do you need to start? You will need a cloud (HP Cloud, Rackspace...) and a service account with enough permissions to manage instances. You will need ansible ... ideally, you should download ansible branch on https://github.com/ansible/ and use develop branch to work. If you execute: $ source ./hacking/env-setup   You will be able to run ansible from that branc