Friday, October 4, 2019

how to setup spinnaker and jenkins using the helm provider

Step1 : 
Login for Azure account :   az login

Step2:  To the set the account to the specific subscription \
az account set -s   ******************

Step3: To get the kubeconfig
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

Step4: Open the K8s dashboard using AZ-CLI
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

Open the K8s dashboard using AZ-CLI
        az aks browse --resource-group demo_cluster --name demo-cluster

Step5: Create clusterrolebinding to give access to kubernetes-dashboard(ServiceAccount) for your respective namespaces
Kubectl create clusterrolebinding view-dashboard  —clusterrole=cluster-admin  —serviceaccount=kube-system:kubernetes-dashboard

Step6:
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
   a.    Create ServiceAccnt & Clusterolebinding with Cluster-admin access the serviceaccnt
   apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
---
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system

Step7:  helm install & init 
helm init
Install Tiller --> helm init --service-account tiller

Extras :

Create a spinnaker :
Why this helm init --upgrade --service-account tiller ?
Error: release default failed: namespaces "default" is forbidden: User "system:serviceaccount:kube-system:default" cannot get resource "namespaces" in API group "" in the namespace "default"
That is why we need to upgrade it.
helm install stable/spinnaker --name spinnaker-demo -n default

Step8: 
Install Traefik in Jenkins Namespace
               helm install stable/traefik --name traefik --set dashboard.enabled=true,serviceType=LoadBalancer,dashboard.domain=example-jenkinsinstance.eastus.***********.com,rbac.enabled=true  --namespace jenkins
Once the FrontEndIP is created under Loadbalancers for Traefik in Azure portal, then create a DNS Label(same as which was specified in  the above command) for this FrontEndIP.

Step9:
Create namespace called  Spinnaker and Install Spinnaker using Helm

      helm install --name spinnaker stable/spinnaker --timeout 600 --namespace=spinnaker

How to create the Dockerfile for Jsonnet

We can use this in the windows operating system.



FROM bitnami/jsonnet:latest

COPY ./demo /var
WORKDIR /var/demo/

ENTRYPOINT [ "jsonnet", "/demo-app-gce.jsonnet" ]

The Directory used in the Dockerfile  ( 

reference repo : https://github.com/spinnaker/spinnaker/tree/master/sponnet/demo

).

run this command to test the jsonnet file:

docker run -it --rm jsonnet-image