Spinnaker : Getting started guide — Part 1 ( Installing Spinnaker )
What is Spinnaker : https://spinnaker.io/
After using Spinnaker for years and spending months on setting it up, here is a quick and easy way to get Spinnaker up and running on an EC2 instance in like under 10min.
Prerequisites and things to know.
- Launch an EC2 instance
- We are going to use https://k3s.io/ for setting up a kubernete’s cluster.
- Come up with a random URL to use in my case I am using spinnaker.corp.nag.com & spinnaker-api.corp.nag.com
- Create an S3 bucket to store the Spinnaker configuration
Installation
- Launch an EC2 and ssh to it,
2. Install the K8 cluster and change the permissions of the config files as
curl -sfL https://get.k3s.io | sh -
sudo chmod 755 /etc/rancher/k3s/k3s.yaml
More info https://k3s.io/
3. Install Spinnaker operator with the instructions present @ https://github.com/armory/spinnaker-operator
You need two config files
- spinnakerservice.yml
apiVersion: spinnaker.io/v1alpha2
kind: SpinnakerService
metadata:
name: spinnaker
spec:
spinnakerConfig:
profiles:
gate:
server:
servlet:
context-path: /api/v1
service-settings:
gate:
healthEndpoint: /api/v1/health
config:
security:
apiSecurity:
ssl:
enabled: false
overrideBaseUrl: https://spinnaker.corp.nag.com/api/v1
corsAccessPattern: https://spinnaker.corp.nag.com
uiSecurity:
ssl:
enabled: false
overrideBaseUrl: https://spinnaker.corp.nag.com
version: 1.29.2 # the version of Spinnaker to be deployed
persistentStorage:
persistentStoreType: s3
s3:
bucket: nag-spinnaker # Change to a unique name. Spinnaker stores application and pipeline definitions here
rootFolder: front50
- spinnakerservice_ingress.yml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: spinnaker
annotations:
kubernetes.io/ingress.class: traefik
ingress.kubernetes.io/ssl-temporary-redirect: "true"
spec:
rules:
- host: spinnaker.corp.nag.com
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: spin-deck
port:
number: 9000
- host: spinnaker.corp.nag.com
http:
paths:
- path: /api/v1
pathType: ImplementationSpecific
backend:
service:
name: spin-gate
port:
number: 8084
tls:
- hosts:
- spinnaker.corp.nag.com
- Copy the above two files into the directory “deploy/spinnaker/basic/”
As of 2023 ( Jan 30 ) : I pinned to the latest spinnaker-operator tag which is https://github.com/armory/spinnaker-operator/archive/refs/tags/v1.3.0-rc.26.tar.gz ( Download the latest one as below )
# Pick a release from https://github.com/armory/spinnaker-operator/releases (or clone the repo and use the master branch for the latest development work)
$ wget https://github.com/armory/spinnaker-operator/archive/refs/tags/v1.3.0-rc.26.tar.gz
$ tar -xvf v1.3.0-rc.26.tar.gz
$ mv spinnaker-operator-1.3.0-rc.26 spinnaker-operator# cd spinnaker-operator
# Install or update CRDs cluster wide
$ kubectl apply -f deploy/crds/
# Install operator in namespace spinnaker-operator, see below if you want a different namespace
$ kubectl create ns spinnaker-operator
$ kubectl -n spinnaker-operator apply -f deploy/operator/cluster
# Update deploy/spinnaker/basic/spinnakerservice.yml to change Spinnaker's persistence bucket name to a unique name (persistentStorage.s3.bucket value)
# Install Spinnaker in "spinnaker" namespace
$ kubectl create ns spinnaker
$ kubectl -n spinnaker apply -f deploy/spinnaker/basic
# Watch the install progress, check out the pods being created too!
$ kubectl -n spinnaker get spinsvc spinnaker -w
3. Add the following to your /etc/hosts file
{Add_your_ec2_public_ip} spinnaker.corp.nag.com
4. Access https://spinnaker.corp.nag.com/
Notes
A few common commands
# How to get the status of the spinnaker-operator status
kubectl -n spinnaker-operator get pods
# How to see the logs of the pod
kubectl logs --follow -n spinnaker spin-igor-7bd74cb48f-tnqpp
Frequently used commands
alias p='kubectl get pods -n spinnaker'
alias 1='kubectl -n spinnaker get spinsvc spinnaker -w'
alias 2='kubectl -n spinnaker describe spinnakerservice'
alias 3='kubectl get svc --namespace=spinnaker'
Conclusion
- Thanks to my colleague Eugune, without him I would not have got this done.
- This is just for POC
- Part-2 on how to configure an AWS account https://medium.com/@nagwww/spinnaker-getting-started-guide-part-2–11675153795