Kubernetes with Jenkins

..

Based on http://www.infoq.com/articles/scaling-docker-with-kubernetes

In a Ubuntu container :
mkdir -p /opt/kubernetes/bin
cd /opt/kubernetes
wget https://github.com/kubernetes/kubernetes/releases/download/v1.0.6/kubernetes.tar.gz
tar -C bin/ -xvf kubernetes.tar.gz
tar -C bin/ -xvf kubernetes-coreos.tar.gztar -C bin/ -xvf kubernetes-coreos.tar.gz
export KUBERNETES_PROVIDER=gce
export KUBERNETES_NUM_MINIONS=2

gcloud auth login

gcloud config list project

cd ./bin/kuberbetes
./cluster/kube-up.sh

K1

# ./cluster/kubectl.sh cluster-info
Kubernetes master is running at https://130.211.118.68
KubeDNS is running at https://130.211.118.68/api/v1/proxy/namespaces/kube-system/services/kube-dns
KubeUI is running at https://130.211.118.68/api/v1/proxy/namespaces/kube-system/services/kube-ui
Grafana is running at https://130.211.118.68/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana
Heapster is running at https://130.211.118.68/api/v1/proxy/namespaces/kube-system/services/monitoring-heapster
InfluxDB is running at https://130.211.118.68/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb

I can use the KubeUI URL to access the KUI, with the user and passwd availabe in /.kube/config

Same for Grafana

# gcloud config set compute/zone us-central1-b
# gcloud config set compute/region us-central1-b
# gcloud compute ssh kubernetes-master

root@kubernetes-master:~# kubectl get namespaces
NAME LABELS STATUS
default <none> Active
kube-system <none> Active

# kubectl create -f ./jenkins.json

# kubectl get pods
NAME READY STATUS RESTARTS AGE
jenkins 1/1 Running 0 12m

# gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
kubernetes-master us-central1-b n1-standard-1 10.240.0.2 130.211.118.68 RUNNING
kubernetes-minion-dmx6 us-central1-b n1-standard-1 10.240.0.5 104.154.41.63 RUNNING
kubernetes-minion-l1sh us-central1-b n1-standard-1 10.240.0.6 104.197.76.30 RUNNING
kubernetes-minion-nz79 us-central1-b n1-standard-1 10.240.0.3 104.154.70.12 RUNNING
kubernetes-minion-q489 us-central1-b n1-standard-1 10.240.0.4 23.236.53.59 RUNNING

Using https://github.com/GoogleCloudPlatform/kube-jenkins-imager

mkdir /opt/kubernetes
git clone https://github.com/GoogleCloudPlatform/kube-jenkins-imager.git
cd kube-jenkins-imager
cp ssl_secrets.template.yaml ssl_secrets.yaml
./cluster_up.sh
kubectl describe service/nginx-ssl-proxy 2>/dev/null | grep ‘LoadBalancer Ingress’ | cut -f2
kubectl describe service/nginx-ssl-proxy
git clone https://github.com/GoogleCloudPlatform/scalable-resilient-web-app.git
cd scalable-resilient-web-app

In the Google Developer Console, navigate to Source Code > Browse, click “Get started” then choose “Push code from a local Git repository to your Cloud Repository”, and follow all of the instructions to push the scalable-resilient-web-app to your Cloud Repository.
git config credential.helper gcloud.sh
git remote add google https://source.developers.google.com/p/natural-axiom-106513/
git push –all google

root@f5340f19193c:/kube-jenkins-imager/scalable-resilient-web-app# git remote -v show -n google | grep Fetch
Fetch URL: https://source.developers.google.com/p/natural-axiom-106513/

Advertisements
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: