Deploying Spinnaker to Google Kubernetes Engine

Abhimanyu Jaju
May 16, 2019 · 7 min read
Image for post
Image for post

What is Spinnaker?

Overview

Prerequisites


Prepare your environment

gcloud container clusters create spinnaker --cluster-version=1.12.7-gke.10 --machine-type=n1-standard-2 --region asia-south1 --num-nodes=1 --disk-size=20GB --disk-type=pd-standard
gcloud iam service-accounts create  spinnaker-account --display-name spinnaker-account
export SA_EMAIL=$(gcloud iam service-accounts list --filter="displayName:spinnaker-account" --format='value(email)')export BUCKET=spinaker-config-20190514export PROJECT=$(gcloud info --format='value(config.project)')
gsutil mb -p $PROJECT -c Standard -l Asia -b on gs://$BUCKET/gsutil iam ch serviceAccount:$SA_EMAIL:roles/storage.admin gs://$BUCKET
gcloud iam service-accounts keys create spinnaker-sa.json --iam-account $SA_EMAIL

Deploying Spinnaker to GKE

brew install kubernetes-helm
kubectl create clusterrolebinding user-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value account)kubectl create serviceaccount tiller --namespace kube-systemkubectl create clusterrolebinding tiller-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account=tiller
helm update
$ helm version
Client: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
export SA_JSON=$(cat spinnaker-sa.json)cat > spinnaker-config.yaml <<EOF
gcs:
enabled: true
bucket: $BUCKET
project: $PROJECT
jsonKey: '$SA_JSON'
# Disable minio as the default storage backend
minio:
enabled: false
# Configure Spinnaker to enable GCP services
halyard:
spinnakerVersion: 1.13.6
image:
tag: 1.19.2
EOF
helm install -n spinnaker stable/spinnaker -f spinnaker-config.yaml --timeout 600 --wait
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
spin-clouddriver-6cd45d4557-6xf89 1/1 Running 0 5m30s
spin-deck-585f6bcf84-xbwn2 1/1 Running 0 5m31s
spin-echo-75cd9d4b76-66tw6 1/1 Running 0 5m34s
spin-front50-7dddd49885-pkxvb 1/1 Running 0 5m28s
spin-gate-677758b98c-p54h7 1/1 Running 0 5m32s
spin-igor-548b477b64-8l8bv 1/1 Running 0 5m31s
spin-orca-686b567659-jsl24 1/1 Running 0 5m29s
spin-rosco-5c55d5c7bf-jf7z9 1/1 Running 0 5m27s
spinnaker-install-using-hal-l5brh 0/1 Completed 0 9m40s
spinnaker-redis-master-0 1/1 Running 0 11m
spinnaker-spinnaker-halyard-0 1/1 Running 0 11m

Publicly accessing Spinnaker

kubectl patch svc spin-deck --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'kubectl patch svc spin-gate --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'
# ingress.ymlapiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: spinnaker-ingress
spec:
rules:
- host: <domain-pointing-to-spinnaker-ui>
http:
paths:
- backend:
serviceName: spin-deck
servicePort: 9000
- host: <domain-pointing-to-spinnaker-api-gateway>
http:
paths:
- backend:
serviceName: spin-gate
servicePort: 8084
kubectl apply -f ingress.yml
$ kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
spinnaker-ingress <ui-domain>,<api-domain> <public-ip-of-lb> 80 5m8s
kubectl exec --namespace default -it spinnaker-spinnaker-halyard-0 bash# the above command will open a shell into the halyard pod which was
# used by helm to deploy spinnaker within the Kubernetes cluster,
# run the following commands within the halyard container
hal config security ui edit --override-base-url http://<ui-domain>hal config security api edit --override-base-url http://<api-domain>hal config security api edit --cors-access-pattern http://<ui-domain>hal deploy apply
{"status":"UP"}

Sharechat

India's leading regional social media

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store