Deploy Spinnaker onto K8S and access via Ingress
Deploy Spinnaker onto K8S and access via Ingress
In this small story, I would like to share how I deployed Spinnaker onto Kubernetes and accessed it via ingress.
Spinnaker is a multi-cloud continuous delivery platform. It provides two main features.
- Application management
- Application deployment
Back in my previous company we used Spinnaker to deploy our microservices onto Kubernetes clusters. I did not involve in setting up the Spinnaker but I created pipelines for microservices. But I always wanted to setup Spinnaker by my own.
As usual I started reading Spinnaker documentation. According to the documentation the recommended way to setup Spinnaker is a distributed installation onto a Kubernetes cluster. So I wanted to try that.
Instructions given by the Spinnaker documentation, were followed.
I installed Halyard using below 2 commands,
curl -O https://raw.githubusercontent.com/spinnaker/halyard/master/install/macos/InstallHalyard.sh
sudo bash InstallHalyard.sh
Then I setup my cloud provider as kubernetes.
hal config provider kubernetes enable
Then added an account.
CONTEXT=$(kubectl config current-context)
ACCOUNT=
do-k8s-v2-accounthal config provider kubernetes account add $ACCOUNT \ --provider-version v2 \ --context $CONTEXT
hal config features edit --artifacts true
Then Halyard was configured to deploy Spinnaker onto Kubernetes. As it is the recommended way to use in production.
hal config deploy edit --type distributed --account-name $ACCOUNT
Then I setup a value for
LONGEST_SERVICE_STARTUP_TIME.
That is used for liveness-probe-initial-delay-seconds
. I setup it as 600 but it can be changed according to your requirement (My k8s is very basic one first time it took some time to spin up pods).hal config deploy edit --liveness-probe-enabled true --liveness-probe-initial-delay-seconds $LONGEST_SERVICE_STARTUP_TIME
Then I selected Redis as my storage. But it is not recommended for production(for this demo it is enough).
hal config storage edit --type redis
Then I did very important thing that is not in the documentation. I setup UI hostname and API host name. I did it using below 2 commands.
hal config security ui edit \
--override-base-url http://spinnaker.prod
hal config security api edit \
--override-base-url http://spinnaker-api.prod
Then Spinnaker version was configured.
hal config version edit --version
1.13.12
Then I applied these changes using below command.
hal deploy apply
When you run above command you will get an error similar below.
Error from server (AlreadyExists): error when creating "STDIN": namespaces
"spinnaker" already exists
Try again running the same command. It will solve the that issue.
What is important next is I created an ingress rules for Spinnaker UI(dek) and API(gate)
Then I got public IP for Spinnaker UI and API by running
kubectl get ingress -n spinnaker
command.
Then I added host entries for spinnaker.prod and spinnaker-api.prod. Then accessed Spinnaker using spinnaker.prod host name. If it doesn’t work first time then you will have to restart spin-deck pod.
Comments
Post a Comment