Installing Spinnaker on Minikube cluster

Hello everyone For learning purposes, I started to look at spinnaker documents but with their documentation, I got a problem and the setup did not work. So I write my own document end container to play with the spinnaker.

In this document, I assume that you have already installed minikube on your system successfully.

Starting the Halyard

Halyard is the tool for configuring, installing and updating for Spinnaker setup.
To start the Halyard, in this document we are using a docker container for this service. You can run the below command to start Halyard on your system.

docker run --name halyard --rm --network host  -v ~/.hal:/home/spinnaker/.hal \
-v ~/.kube/:/home/spinnaker/.kube -v ~/.kube/:/root/.kube -v ~/.minikube/:/root/.minikube -it ghcr.io/ahmetozer/halyard-container

When you see the Halyard started output on the terminal, you can start a shell from the new terminal to start the Halyard setup.

docker exec -it halyard bash

Setting up the provider

We are working with Minikube, so we have to select Kubernetes as a provider.
But before selecting Kubernetes as a provider for Halyard, we can create a new service account in Kubernetes to use in Halyard.

You can put the below command to the Halyard`s terminal which was created in the previous stage.

# Run in Halyard container
CONTEXT=$(kubectl config current-context)
kubectl apply --context $CONTEXT \
    -f https://spinnaker.io/downloads/kubernetes/service-account.yml

TOKEN=$(kubectl get secret --context $CONTEXT \
   $(kubectl get serviceaccount spinnaker-service-account \
       --context $CONTEXT \
       -n spinnaker \
       -o jsonpath='{.secrets[0].name}') \
   -n spinnaker \
   -o jsonpath='{.data.token}' | base64 --decode)

kubectl config set-credentials ${CONTEXT}-token-user --token $TOKEN
kubectl config set-context $CONTEXT --user ${CONTEXT}-token-user

Adding a kubernetes account to Halyard.

# Run in Halyard container

hal config provider kubernetes enable

ACCOUNT="my-k8s-account"
hal config provider kubernetes account add ${ACCOUNT} \
    --context ${CONTEXT}

Halyard has a few options to run Spinnaker services such as Local install, Local git and Distributed. We are continuing with Distributed for the spinnaker services run in Kubernetes.

hal config deploy edit --type distributed --account-name $ACCOUNT

Storage setup

For persisting your Application settings and configurations, Spinnaker needs an external storage provider.
We are deploying this setup locally and for this purpose, I continue with Minio as an external storage service.

Create a new terminal on your computer or server and start Minio. The below command gives Environment variables. These variables are used in the next step to inform Halyard storage options.

# System
MINIO_ROOT_USER=$(< /dev/urandom tr -dc a-z | head -c${1:-4})
MINIO_ROOT_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-8})
MINIO_PORT="9010"

# Start the container
docker run -it -d --rm -v ~/.minio-data/:/data --name minio-4-spinnaker -p ${MINIO_PORT}:${MINIO_PORT} \
-e MINIO_ROOT_USER=${MINIO_ROOT_USER} -e  MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD} \
 minio/minio  server /data --address :${MINIO_PORT}

# This information is used in next {.1}

echo "
MINIO_ROOT_USER=${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
ENDPOINT=http://$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' minio-4-spinnaker):${MINIO_PORT}
"

Switch to Halyard’s terminal and firstly disable the versioning objects for Minio. Then paste environment variables into Halyard’s terminal. After setting environment variables you can set Minio as an external storage service. The last step for storage configuration is setting storage type and path style.

# Run in Halyard container
DEPLOYMENT="default"
mkdir -p ~/.hal/$DEPLOYMENT/profiles/
echo spinnaker.s3.versioning: false > ~/.hal/$DEPLOYMENT/profiles/front50-local.yml

#! Paste given environment variable in previous at {.1}
# Setting minio account information to hal
echo ${MINIO_ROOT_PASSWORD} | hal config storage s3 edit --endpoint $ENDPOINT \
    --access-key-id ${MINIO_ROOT_USER} \
    --secret-access-key

# Enable s3 storage and change path style
hal config storage edit --type s3
hal config storage s3 edit --path-style-access=true

Deploy and Connect

Still we have not selected the Halyard version. Before selecting the version, we can see the Halyard versions with hal version list command. While writing this blog, the latest version is 1.26.3 , and I selected 1.26.3 as a version.

# Spinnaker user
hal config version edit --version  1.26.3

Halyard configuration is done, now we can start to deploy Spinnaker on Kubernetes. Setup is done with hal deploy apply command but this command takes time to complete because it is installing some required apps and tools in a container that is used for deployment.

hal deploy apply

When the deployment is applied, the system is ready to access. For accessing the system you need a deploy connect to expose microservices to your system.

# Root user
hal deploy connect

Visit http://localhost:9000 to start the Spinnaker web ui.

Thank you for reading this blog. I hope it is helpful for you, take care, see you next time.


© 2024 All rights reserved.

Powered by Hydejack v7.5.0