1
votes

Am using spinnaker helm chart to deploy Spinnaker in my kubernetes cluster.

https://github.com/helm/charts/tree/master/stable/spinnaker

Using the below steps we can add k8s cluster to spinnaker.

  1. Upload kubeconfig to a secret
$ kubectl create secret generic --from-file=$HOME/.kube/config my-kubeconfig
  1. Set the following values of the chart:
kubeConfig:
  enabled: true
  secretName: my-kubeconfig
  secretKey: config
  contexts:
  # Names of contexts available in the uploaded kubeconfig
  - my-context
  # This is the context from the list above that you would like
  # to deploy Spinnaker itself to.
  deploymentContext: my-context

I would like to include Dev,Test,QA k8s clusters. I can only include Dev. Let me know how do i include more than one cluster.

2

2 Answers

0
votes

You need to make sure all your contexts are in your $HOME/.kube/config file:

contexts:
- context:
    cluster: dev
    user: dev
  name: dev
- context:
    cluster: test
    user: test
  name: test
- context:
    cluster: qa
    user: qa
  name: qa

And you need to append all contexts on values.yaml file before deploying:

kubeConfig:
  enabled: true
  secretName: my-kubeconfig
  secretKey: config
  contexts:
  # Names of contexts available in the uploaded kubeconfig
  - dev
    test
    qa
  deploymentContext: dev
0
votes

You have to specify different config files for the clusters. If you using spinnaker with helm version 2 chart templates.
Once, you have done step 1. step 2: update the values.yaml section for additional scripts:

additionalScripts: create: true data: add_config.sh: |-

    echo "Configuring k8s additional accounts"
    $HAL_COMMAND config provider kubernetes account add testcluster
    $HAL_COMMAND config provider kubernetes account edit testcluster --docker-registries dockerhub \
    --context testcluster --kubeconfig-file /opt/kube/config-testcluster --only-spinnaker-managed true \
    --omit-namespaces=kube-system,kube-public,devops,default --provider-version v2

step 3: Create a different kubeConfigtestcluster section for each cluster.

kubeConfigtestcluster: enabled: true

step 4: update your halyard.yaml template file to mount the secret created in step 1, into the halyard pod.

step 5: upgrade or create a new helm deployment.