-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins.sh
24 lines (18 loc) · 1.06 KB
/
jenkins.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
gcloud container clusters create jenkins-cd \
--zone=us-east1-d --machine-type n1-standard-2 --num-nodes 2 \
--scopes "https://www.googleapis.com/auth/projecthosting,cloud-platform"
wget https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
tar zxfv helm-v2.9.1-linux-amd64.tar.gz
cp linux-amd64/helm .
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin \
--user=$(gcloud config get-value account)
kubectl create serviceaccount tiller --namespace kube-system
kubectl create clusterrolebinding tiller-admin-binding --clusterrole=cluster-admin \
--serviceaccount=kube-system:tiller
./helm init --service-account=tiller
./helm repo update
./helm version
./helm install -n cd stable/jenkins -f jenkins/values.yaml --version 0.16.6 --wait
export POD_NAME=$(kubectl get pods -l "component=cd-jenkins-master" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward $POD_NAME 8080:8080 >> /dev/null &
printf $(kubectl get secret cd-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo