Tuesday, November 26, 2019

Getting Started with Spinnaker locally using minikube(local Kubernetes)

Before jumping to Installation and setup part, first of all, lets briefly summarize about the "What is Spinnaker"



Spinnaker : 

            Spinnaker is an open-source, multi-cloud continuous delivery platform for releasing software changes with high velocity and confidence.

          I am not going in many details about the functionality here but would like to highlight the main architectural component which I think we should know at least before starting playing with this. This will help you in troubleshooting if got stuck in between.

So, Spinnaker is composed on multiple components. You will be able to see all these after we complete the setup. List of different components is as below(currently just copy-pasting from the official site)-
  1. Deck is the browser-based UI.
  2. Gate is the API gateway.
    The Spinnaker UI and all api callers communicate with Spinnaker via Gate.
  3. Orca is the orchestration engine. It handles all ad-hoc operations and pipelines. Read more on the Orca Service Overview.
  4. Clouddriver is responsible for all mutating calls to the cloud providers and for indexing/caching all deployed resources.
  5. Front50 is used to persist the metadata of applications, pipelines, projects and notifications.
  6. Rosco is the bakery. It produces immutable VM images (or image templates) for various cloud providers.
    It is used to produce machine images (for example GCE imagesAWS AMIsAzure VM images). It currently wraps packer, but will be expanded to support additional mechanisms for producing images.
  7. Igor is used to trigger pipelines via continuous integration jobs in systems like Jenkins and Travis CI, and it allows Jenkins/Travis stages to be used in pipelines.
  8. Echo is Spinnaker’s eventing bus.
    It supports sending notifications (e.g. Slack, email, SMS), and acts on incoming webhooks from services like Github.
  9. Fiat is Spinnaker’s authorization service. 
    It is used to query a user’s access permissions for accounts, applications and service accounts.
  10. Kayenta provides automated canary analysis for Spinnaker.
  11. Halyard is Spinnaker’s configuration service.
Halyard manages the lifecycle of each of the above services. It only interacts with these services during Spinnaker startup, updates, and rollbacks.

Note - In our setup "Fiat and Kayenta" will not be present as this is not available in the helm chart that we have installed on minikube.
Along with Architecture, I guess we should know the ports mapping as well.


Minikube - 

        Minikube provides a way to setup Kubernetes locally for development purpose. I am not going in details about the installation. Please go through my previous blog post if you want to install minikube.

After installation, let's start minikube cluster. I am starting with my custom configuration so that it should be able to handle the load.



Other Tools -

     Apart from minikube, below are the other tools that we need and I am supposing that these are already installed.
  1. helm
  2. kubectl



Install Spinnaker -

        Now, we have minikube with helm installed and running. We are ready to install spinnaker. We will install spinnaker using helm chart.
Helm is a templating engine for k8s deployments. We need to provide values those templates. So, to start with they are providing the default set of values which we are going to use.


Download the default values file form above helm repo.
$ curl -Lo values.yaml https://raw.githubusercontent.com/kubernetes/charts/master/stable/spinnaker/values.yaml



Now, let's install the spinnaker to K8S cluter.
$ helm install -n spinnaker-local stable/spinnaker -f values.yaml --timeout 300   --namespace spinnaker


Tip - In case you get timed out exception in first run(like below). Then please delete the helm installation using "helm del --purge {release-name}" and re-run the same command again.


After successful installation, check for the pods in "spinnaker" namespace. All should be in running state. 



P.S. - Please ignore the hal status in above output. Its taking some time to start :).

To access the Spinnaker UI, follow the above instructions. If you notice then in above output we are doing the port-forward for two pods. As per the architecture, these two components are responsible for below functionalities.
  • First one is "deck" - which is providing the UI dashboard
  • Second one the "gate" - which is responsible for accesing the apis.
#export DECK_POD=$(kubectl get pods --namespace spinnaker -l "cluster=spin-deck" -o jsonpath="{.items[0].metadata.name}")
#export GATE_POD=$(kubectl get pods --namespace spinnaker -l "cluster=spin-gate" -o jsonpath="{.items[0].metadata.name}")
#echo $DECK_POD
#echo $GATE_POD
#alias ui='kubectl port-forward --namespace spinnaker $DECK_POD 9000'
#alias api='kubectl port-forward --namespace spinnaker     $GATE_POD 8084'
#ui & api &




Access the Spinnaker Dashboard




In next post we'll try to create pipelines which will deploy entities on kubernetes. Also in later posts we'll explore more on the integration with different providers e.g. Jenkins/Cloud vendors.


Kubernetes 1.31 || Testing the Image Volume mount feature using Minikube

With Kubernetes new version 1.31 ( https://kubernetes.io/blog/2024/08/13/kubernetes-v1-31-release/ ) there are so many features releases for...