Skip to main content

Posts

Showing posts from 2015

Kubestack: dynamic jenkins slaves using Kubernetes

In this article I will show KubeStack, a python daemon and command line tool to spin un dynamic Jenkins slaves using Kubernetes: https://github.com/kubestack/kubestack How to install it KubeStack is currently a POC, so it's not still published as a package. To install it, you can clone from the upper url. KubeStack project is divided on three directories: ansible : a set of scripts and documentation explaining how to setup a Kubernetes cluster on OpenStack images : Dockerfile and scripts used to generate Jenkins slaves app : KubeStack application to interact with Kubernetes and Jenkins To install the KubeStack application, you need to go the the app/kubestack directory, and install the requirements listed on requirements.txt file. You can run the daemon using: python kubestack/cmd/kubestackd.py (-d if you don't want as a daemon).  Also a CLI tool is available on kubestack/cmd/kubestackcmd.py How to configure KubeStack relies on a configuration file, that li

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