Setting the Spinnaker in Unix/Linux

Spinnaker is a platform for the creation of continuous deployment on our pipeline, allowing you to quickly and confidently inform about the changes. This software was developed Netflix, then started supporting Google. Is used to deploy applications in Kubernetes (k8s) automatic way.

The architecture looks like the following:

Components Spinnaker-a:

  • Deck: One of the microservices, which legit web UI interface for coniguration Spinnaker through the web browser. Also, viewing applications and projects on our pipeline.
  • Gate: One of the microservices, which logic API service and user interface Spinnaker, which communicate with the server Spinnaker through the API gateway, called Gate.
  • Orca: One of the microservices, which serves to control on our pipeline and other operations through orchestrovic called Orca.
  • Clouddriver: One of the microservices, which is used for indexing and caching of deployed resources. Also, interacts with cloud providers such as AWS, GCE and Azure.
  • Echo: One of the microservices, which is responsible for sending notifications, and also acts as an incoming webhook-a.
  • Igor: One of the microservices used to run the pipelines (pipelines) by using jobs continuous integration systems such as Jenkins and Travis CI, and allows you to use Jenkins / Travis stag-s on our pipeline.
  • Front50: One of the microservices, which serves as a metadata store in Spinnaker. It stores metadata for all resources, including pipeline, projects, applications and notifications.
  • Rosco: One of the microservices, which is used to create (abbreviation bakes in the Spinnaker) of machine images (AMIs AWS, Azure, VM images, GCE images).
  • Rush: One of the microservices used for scripting.

Let’s install.

Setting the Spinnaker in Unix/Linux

There are quite a few ways to set the Spinnaker on different OS. Lead visual examples of how it can be done.

Installation methods Spinnaker in Unix/Linux:

  • To use Minio (when using Docker Minikube or Desktop).
  • Use AWS S3 (using the Docker Minikube or Desktop).
  • Use channelise from GCP (when using Docker Minikube or Desktop). Until examples.
  • Azure storage (when using Docker Minikube or Desktop).
  • Redis (if you are using Docker Minikube or Desktop). Until examples.
  • Also, it will be possible to set the Spinnaker using AWS EKS. Until examples.
  • It will be possible to set the Spinnaker using GCP GKE. Until examples.

Setting the spinnaker using Docker Desktop in Unix/Linux

I have Makos and I will use Docker Desktop. I have it already installed, this will start.

The installation methods described in this paragraph:

  • To Use Minio.
  • Use AWS S3.

You will need to configure Docker to use the following resources:

  • 4Gb RAM. I ispolzuu 9Гб.
  • 2Gb swap (swap). I ispolzuu 4Gb.
  • 4 CPU cores. I ispolzuu 6 cores.

Custom and restart Docker.

Install Halyard:

# cd /usr/local/src && $ curl -O https://raw.githubusercontent.com/spinnaker/halyard/master/install/macos/InstallHalyard.sh

Install:

$ sudo bash ./InstallHalyard.sh -y --user $USER

Check the version:

$ hal-v
1.21.1-20190624135101

Or, you can view the list of available versions:

$ hal version list

To use another version, run:

$ hal version config edit --version 1.12.13

Where:

  • 1.12.13 — Is version.

It can be installed using Docker, but I don’t have to.

Will carry out the installation of some bodies:

$ brew install kubectl kubernetes-helm 

PS: If you have not installed homebrew, install here.

Switch to the desired context:

$ kubectl config use-context to docker-for-desktop

Allow kubernetes:

$ helm init --wait

Check whether kubernetes provider:

$ hal config provider kubernetes enable

Install context and the name of the account:

$ export CONTEXT=$(kubectl config current-context) 
$ export ACCOUNT=my-k8s-v2-account

Add account:

$ hal config provider kubernetes add account $ACCOUNT 
 --provider-version v2 
 --context $CONTEXT

Expose config options:

$ hal config edit --features artifacts true

Spinnaker is deployed in a local Kubernetes cluster, with each micro service is deployed independently. Performed Halyard setup the Spinnaker and microservices, providing zero downtime updates.

Install options ENV:

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

Next, you should choose the storage to use for storing config files, projects, applications. Choose one of the proposed below, and perform a number of actions which it describes.

-=== Use Minio ===-

For Spinnaker requires external storage to save the settings of your app and configured on our pipeline — as an example, we will deploy Minio S3 Kubernetes in a separate context.

Minio is S3-compatible object store, which you can install yourself (self-khosted).

Will probrosit necessary variables:

$ export MINIO_ACCESS_KEY="VHK5D359RAXHEXAMPLE" && 
export MINIO_SECRET_KEY="vE8qPsiWjluG2mZRD1WHZANzSYW8X8C3bexample" && 
export MINIO_STORAGE_NAME="local-s3-storage" 

– Launched minio:

$ helm install 
 --set persistence.size=8Gi 
 accessKey --set=$MINIO_ACCESS_KEY,secretKey=$MINIO_SECRET_KEY 
 --name $MINIO_STORAGE_NAME 
 --namespace storage 
 stable/minio

Run the following command:

$ kubectl get pods --namespace=storage -w

Wait until “READY 1/1”

We need another variable:

$ export POD_NAME=$(kubectl get pods --namespace storage-l "release=`echo ${MINIO_STORAGE_NAME}`" -o jsonpath="{.items[0].metadata.name}")

Next, run the proxy in the background:

$ nohup kubectl port-forward $POD_NAME 9001:9000 --namespace storage &

PS: Unable to open http://localhost:9001 to go into S3 storage.

Define endpoint which we will use:

$ export ENDPOINT="http://${MINIO_STORAGE_NAME}.storage.svc.cluster.local:9000"

Also, you should choose a name for the deployment:

$ export DEPLOYMENT=default

Let’s create a project:

$ mkdir -p ~/.hal/$DEPLOYMENT/profiles

Select the option of ignoring the versions of the S3:

$ echo "spinnaker.s3.versioning: false" > 
 ~/.hal/$DEPLOYMENT/profiles/front50-local.yml

Configurable S3 storage endpoint and credensa for Halyard:

$ echo $MINIO_SECRET_KEY | hal s3 storage config edit 
 --endpoint $ENDPOINT 
 --access-key-id $MINIO_ACCESS_KEY 
 --secret-access-key # will be read on STDIN

Include created S3 storage:

$ hal storage config edit --type s3

Now, when turned provider Kubernetes (Docker for Desktop), chose a distributed deployment environment and set up persistent storage Minio S3, now you need to select the version of Spinnaker, deploy, and connect to it.

Set the version for the deployment Spinnaker:

$ export VERSION="1.14.7" && 
hal config edit version --version $VERSION

Performed deployment:

$ hal apply deploy

To check States, you can use:

$ kubectl get pods --namespace=spinnaker -w

Performed by forwarding port 9000 (Deck UI) and 8084 (Gate API service):

$ hal deploy connect

-=== Use AWS S3 ===-

Execute:

$ export AWS_ACCESS_KEY="AWS_ACCESS_KEY"
$ export AWS_SECRET_KEY="AWS_SECRET_KEY"
$ export AWS_REGION="eu-north-1"
$ export AWS_S3_STORAGE_NAME="AWS_S3_STORAGE_NAME" 
$ export AWS_S3_ENDPOINT="https://${AWS_S3_STORAGE_NAME}.s3.amazonaws.com"
$ export DEPLOYMENT=default
$ mkdir -p ~/.hal/$DEPLOYMENT/profiles
$ echo "spinnaker.s3.versioning: false" > 
~/.hal/$DEPLOYMENT/profiles/front50-local.yml
$ echo $AWS_SECRET_KEY | hal s3 storage config edit 
 --AWS_S3_ENDPOINT $AWS_S3_ENDPOINT 
 --access-key-id $AWS_ACCESS_KEY 
 --region $REGION 
 --secret-access-key # will be read on STDIN
$ hal storage config edit --type s3

That’s all.

Remove custom stuff

To remove just created, you need to perform the following commands.

For starters, remove all deployment from Spinnaker:

$ hal deploy clean

Run the command to check:

$ kubectl get pods --namespace=spinnaker -w

Remove the namespace:

$ kubectl delete namespace spinnaker

Finish proxy from minio:

$ kill $(ps-ef | grep port-forward | grep my-s3-storage | awk '{ print $2 }')

Remove minio:

$ kubectl delete the deployment ${MINIO_STORAGE_NAME} --namespace storage 
$ helm delete --purge ${MINIO_STORAGE_NAME}

Again, you can run the command to check:

$ kubectl get pods --namespace=storage -w

Remove the namespace:

$ kubectl delete namespace storage

Still, eating you need to remove more and Halyard, then perform:

$ kill $(ps-ef | grep com.netflix.spinnaker.halyard.Main | awk '{ print $2 }')
$ sudo ~/.hal/uninstall.sh

The deletion is complete.

Setting the spinnaker using Minikube in Unix/Linux

Install Halyard:

# cd /usr/local/src && $ curl -O https://raw.githubusercontent.com/spinnaker/halyard/master/install/macos/InstallHalyard.sh

Install:

$ sudo bash ./InstallHalyard.sh -y --user $USER

I will use minikube to work with k8s:

$ minikube start --cpus 4 --memory 8192

Look under s:

$ kubectl get nodes

Select the context:

$ kubectl config use-context minikube

Inicijaliziram:

$ helm init --wait

Turn the cube:

$ hal config provider kubernetes enable

Probressive variables:

$ export MINIO_ACCESS_KEY=VHK5D359RAXHEXAMPLE && 
 export MINIO_SECRET_KEY=vE8qPsiWjluG2mZRD1WHZANzSYW8X8C3bexample && 
 export ACCOUNT=demo-account

In a separate terminal window, run mini:

$ docker run-p 9000:9000 --name minio1 
 -e "MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}" 
 -e "MINIO_SECRET_KEY=${MINIO_SECRET_KEY}" 
 minio/minio server /data

NOTE: you can also add:

  • -v /home/captain/minio/data:/data
  • -v /home/captain/minio/config:/root/.minio

But you need to create them to begin with (I folder).

Add mini to kubernetes:

$ echo ${MINIO_SECRET_KEY} | hal config edit --storage s3 endpoint http://localhost:9000 --access-key-id ${MINIO_ACCESS_KEY} --secret-access-key
+ Get current deployment
Success
+ Get the persistent store
Success
Generated bucket name: spin-ec1fb70b-43b4-4a05-88ab-868e8950637a
+ Edit the persistent store
Success
Problems in default.persistentStorage:
- WARNING Your deployment will most likely fail until you configure
 and enable a persistent store.

+ Successfully edited the persistent store "s3".

And then another command:

$ hal storage config edit --type s3
+ Get current deployment
Success
+ Get persistent storage settings
Success
+ Edit persistent storage settings
Success
+ Successfully edited the persistent storage.

To configure kubernetes Spinnaker requires at least Docker registry. Add registry so:

hal config provider docker-registry add dockerhub account --address index.docker.io --library repositories/nginx

NOTE: you Can use a private Docker registry. For example, to run a local Docker-registry, you can run:

$ docker run-d-p 5000:5000 --restart=always --name registry registry:2

Can add private Docker registry:

$ hal config provider docker-registry account add docker-private-repo --address https://localhost:5000 --username myuser --password mypassword
+ Get current deployment
Success
+ Add the docker-private-repo account
Success
Problems in default.provider.dockerRegistry.docker-private-repo:
- WARNING Your docker registry has no specified repositories, and
 the registry's catalog is empty. Spinnaker will not be able to deploy any images
 until some are pushed to this registry.
? Manually specify some repositories for this docker registry to
index.

+ Successfully added account docker-private-repo for a provider
 dockerRegistry.

Allow Docker registry:

$ hal config provider docker-registry enable
+ Get current deployment
Success
+ Edit the dockerRegistry provider
Success
Problems in default.provider.dockerRegistry.docker-private-repo:
- WARNING Your docker registry has no specified repositories, and
 the registry's catalog is empty. Spinnaker will not be able to deploy any images
 until some are pushed to this registry.
? Manually specify some repositories for this docker registry to
index.

+ Successfully enabled dockerRegistry

Add account:

$ hal config provider add kubernetes account ${ACCOUNT} --kubeconfig-file=/Users/captain/.kube/config --docker-registries dockerhub --context $(kubectl config current-context)
+ Get current deployment
Success
+ Add the demo-account for account
Success
+ Successfully added account demo account for provider
 kubernetes.

Install options ENV:

$ hal config edit deploy --type=distributed --account-name ${ACCOUNT}
+ Get current deployment
Success
+ Get the deployment environment
Success
+ Edit the deployment environment
Success
+ Successfully updated your deployment environment.

Watch the Spinnaker version:

$ hal version list
+ Get current deployment
Success
+ Get the Spinnaker version
Success
+ Versions Get released
Success
+ You are on version "", and the following are available:
 - 1.12.13 (Unbreakable):
 Changelog: https://gist.github.com/spinnaker-release/89e02b2d04aff5b5cab69c3963cbb157
 Published: Thu Jun 20 18:12:21 EEST 2019
 (Requires Halyard >= 1.11)
 - 1.13.10 (BirdBox):
 Changelog: https://gist.github.com/spinnaker-release/3056119e8dd52f5d24041fdf0a42fe3e
 Published: Thu Jun 20 18:31:31 EEST 2019
 (Requires Halyard >= 1.17)
 - 1.14.1 (LoveDeathAndRobots):
 Changelog: https://gist.github.com/spinnaker-release/4b4bb42d4e3b6073fbd5f89fa7c3e060
 Published: Fri May 24 18:17:14 EEST 2019
 (Requires Halyard >= 1.17)
 - 1.14.7 (LoveDeathAndRobots):
 Changelog: https://gist.github.com/spinnaker-release/cf6b8a7290ba0d9277360e7a794e0b6b
 Published: Mon Jun 24 17:03:24 EEST 2019
 (Requires Halyard >= 1.17)

Choose the right and apply the settings:

$ hal version config edit --version 1.14.7
+ Get current deployment
Success
+ Edit Spinnaker version
Success
+ Spinnaker has been configured to update/install version "1.14.7".
 Deploy this version of Spinnaker with `hal deploy apply`.

Deploym:

$ hal apply deploy

During deployment, you can look at the generated pod:

$ kubectl get pods --namespace spinnaker -w
NAME READY STATUS RESTARTS AGE
spin-clouddriver-bootstrap-v000-s2pnh 1/1 0 Running 105s
spin-clouddriver-v000-bs8gt 0/1 0 Running 26s
spin-deck-v000-hdwtg 1/1 0 Running 26s
spin-echo-v000-8qnfr 0/1 0 Running 26s
spin-front50-v000-7nxn6 0/1 0 Running 26s
spin-gate-v000-qgq9w 0/1 0 Running 26s
spin-igor-v000-bfpp4 0/1 0 Running 25s
spin-orca-bootstrap-v000-swvpr 1/1 0 Running 69s
spin-orca-v000-njqz2 0/1 0 Running 26s
spin-redis-bootstrap-v000-vkpx4 1/1 0 Running 110s
spin-redis-v000-rtbfj 1/1 0 Running 37s
spin-rosco-v000-lwrc2 0/1 0 Running 25s

To launch the Spinnaker UI:

$ hal deploy connect

If you don’t want to use hal to connect, you can do port forwarding on modules Spinnaker:

alias spin_gate='kubectl port-forward-spinnaker n $(kubectl get pods -spinnaker n-o=custom-columns=NAME:.metadata.name | grep gate) 8084:8084'

alias spin_deck='kubectl port-forward-spinnaker n $(kubectl get pods -spinnaker n-o=custom-columns=NAME:.metadata.name | grep deck) 9001:9000'

spinnaker alias='spin_gate &; spin_deck &'

After that, run:

$ spinnaker
[1] 20836
[2] 20840

"Forwarding from 127.0.0.1:8084 -> 8084
Forwarding from [::1]:8084 -> 8084
Forwarding from 127.0.0.1:9001 -> 9000
Forwarding from [::1]:9001 -> 9000

Open http://localhost:9001

Ready!

Setting the spinnaker using Docker and Docker-Compose in Unix/Linux

Copy the code:

$ git clone https://github.com/spinnaker/spinnaker.git

Go to the folder:

$ cd spinnaker/experimental/docker-compose/

For ease of use, I will create a new Docker-machine:

$ docker-machine create spinnaker

Next, execute:

$ export DOCKER_IP=$(docker-machine ip spinnaker) && 
docker-compose up-d

After deployment, you can run:

$ open http://$(docker-machine spinnaker ip):9000

Honestly, I did not start this way. I left the action as example. The launch is in an experimental mode, they are also tested and adjusted.

Setting the spinnaker using Kubernetes and Helm in Unix/Linux

Install kubernetes (Docker for Desktop or Minikube, AWS EKS, GCP GKE etc).

For this example, I’ll take Docker for Desktop. Have configured as in the example above.

Set HELM:

Installing Helm on Unix/Linux

Then, for a downloadable chart:

$ curl -Lo values.yaml https://raw.githubusercontent.com/kubernetes/charts/master/stable/spinnaker/values.yaml

Edit values.yaml to insert credentials Docker Hub account dockerhub. Add the repo, which you opened from my account on Github, in the repository list, for example:

.........
dockerRegistries:
- name: dockerhub
 address: index.docker.io
 username: YOUR_USERNAME_HERE
 password: YOUR_PASSWORD_HERE
repositories:
 - library/alpine
 - library/ubuntu
 - library/centos
 - library/nginx
.........

Where:

  • YOUR_USERNAME_HERE — User from the Docker Hub
  • YOUR_PASSWORD_HERE — Password of the user from the Docker Hub

I had an error with minio UNDER-om, the fix was the replacement tag for the image minio, the block looks like this:

.....
minio:
 enabled: true
 imageTag: latest
 serviceType: ClusterIP
 accessKey: spinnakeradmin
 secretKey: spinnakeradmin
 bucket: "spinnaker"
 pullPolicy: IfNotPresent
 nodeSelector: {}
.......

Now run the Spinnaker with the updated configuration:

$ helm install-n kubelive stable/spinnaker -f values.yaml --timeout 300 --version 0.3.5 --namespace spinnaker

Open the port Spinnaker for the host using the following commands:

$ export DECK_POD=$(kubectl get pods --namespace spinnaker -l "component=deck,app=kubelive-spinnaker" -o jsonpath="{.items[0].metadata.name}") && 
kubectl port-forward --namespace spinnaker $DECK_POD 9000

After that, you can open a Spinnaker from a browser by visiting http://localhost:9000

Something like that.

Setting the spinnaker using AWS EKS in Unix/Linux

Have not tried it. Leave so, after a complement.

Setting the spinnaker using GCP GKE in Unix/Linux

Have not tried it. Leave so, after a complement.

Setup/Use of Spinnaker in Unix/Linux

And so, the configuration was successful. Opened on Spinnaker http://localhost:9000. Home village Spinnaker is as follows:

In the search box, you can search for projects, a cluster of LB, security groups etc. and etc. For example:

Start using!

Create Spinnaker pipeline

Will start creating the application called MyTestApp:

Click on the button “Create”. The application you created looks like this:

Come on, create a load balancer, to do this click on the “Load Balancers” -> “Create Load Balancer”:

In the tab “BASIC SETTINGS”, fill in:

  • Account -> local.
  • Namespace -> default.
  • Stack -> prod.

Further, in the tab “PORTS”:

In this tab is to register:

  • Target Port -> 80.

Further, in the tab “ADVANCED SETTINGS”:

In this tab, write:

  • Type -> NodePort.

Click on “Create”. Similar actions, creating a LB with the name “dev”, but only in the last tab you should choose “ClusterIP”:

After that, it should come out something like the following:

Foreheads is ready and now you can create a pipeline, go to this tab and click on “Create”:

Fill:

  • Pipeline Name -> DeployToProd

Click on “Create”:

Click on “Save Changes”. Scrollable trznica up and click on “Add stage”:

Fill:

  • Stage name -> Deploy

Then click on “Add server group”:

I chose:

  • Copy configuration from -> None. Because I have no appropriate templates for this deployment.

Click on “Continue without a template”:

Click on the tab “LOAD BALANCERS” and select the desired (in this case — mytestapp-prod):

Go to “CONTAINER” tab and fill in:

In this tab, is to access “Probes” and add the use of Readiness Liveness Probe and Probe:

So, click on “Add” to add our change. And then click on “Save Changes”.

Because I deploy with nginx and not the app ID (so would have triggered the trigger on commit), it will launch the “Start manual execution”:

Choose parameters:

Click on “Run”.

Receive services:

$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ClusterIP 10.96.0.1 kubernetes <none> 443/TCP 178m
mytestapp-dev ClusterIP 10.105.171.103 <none> 80/TCP 47m
mytestapp-prod NodePort 10.109.30.179 <none> 80:30294/TCP 57m

To test whether the deployment will probrosit proxy Cuba:

$ kubectl proxy
Starting to serve on 127.0.0.1:8001

NOTE: in order for proxies worked in the background, execute:

$ kubectl proxy &

Because I have deploy mytestapp-prod app, but it is http://127.0.0.1:30294/ click on it and find ourselves actually zatepleny nginx!

Is to perform a series of actions for the dev stage. Click On “Pipelines” -> “Create”. Name choose the name “DeployToDev”:

Then. Click on “Save Changes”. And click “Add Stage”:

Fill:

  • Type -> Deploy.
  • Stage Name -> Deploy.

In the “Add server group”, choose “mytestapp-prod-v000”:

Select from the list and click on “Use this template”. It will copy the template to the new one. A little fix it:

Next, in the “Load Balancers”:

Replaced and go to “Container”:

In the tab “Probes” include Readiness Liveness Probe and Probe (as in the examples above). After all settings, click on “Add” -> “Save Changes”.

Return to the main menu aplicacin and click on the just created pipeline:

Download dashboards for Cuba:

$ kubectl apply-f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml

Look tokens:

$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

Open — http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

Using the data of Burgundy can look old.

In the end, Sadaam new pipeline called PromoteToProd:

Click on “Create”. And fill the fields:

Click on “Save Changes”. Then, open the “Add Stage”:

Complete and click on “Save Changes”. Click on “Add stage” to create a deployment on PROD:

Click on “Add server group” and choose “Copy configuration from”, namely with “None” and click on “Continue without any templates”. Fill:

Click on “Add” -> “Save Changes”.

Click on builds. Toss with the dev -> prod:

Check using SP deployment! It should work.

That’s all the article “setting the Spinnaker in a Unix/Linux” is completed.

Source: linux-notes.org

(Visited 60 times, 1 visits today)