[英]How to Add Kubernetes Clusters to Spinnaker
Am using spinnaker helm chart to deploy Spinnaker in my kubernetes cluster.我正在使用 spinnaker helm chart 在我的 kubernetes 集群中部署 Spinnaker。
https://github.com/helm/charts/tree/master/stable/spinnaker https://github.com/helm/charts/tree/master/stable/spinnaker
Using the below steps we can add k8s cluster to spinnaker.使用以下步骤,我们可以将 k8s 集群添加到 spinnaker。
$ kubectl create secret generic --from-file=$HOME/.kube/config my-kubeconfig
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.我想包括 Dev、Test、QA k8s 集群。 I can only include Dev.我只能包括 Dev。 Let me know how do i include more than one cluster.让我知道如何包含多个集群。
You need to make sure all your contexts are in your $HOME/.kube/config
file:你需要确保你的所有上下文都在你的$HOME/.kube/config
文件中:
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:并且您需要在部署之前在values.yaml
文件中附加所有上下文:
kubeConfig:
enabled: true
secretName: my-kubeconfig
secretKey: config
contexts:
# Names of contexts available in the uploaded kubeconfig
- dev
test
qa
deploymentContext: dev
You have to specify different config files for the clusters.您必须为集群指定不同的配置文件。 If you using spinnaker with helm version 2 chart templates.如果您将 Spinnaker 与 helm 版本 2 图表模板一起使用。
Once, you have done step 1. step 2: update the values.yaml section for additional scripts:一次,您已完成第 1 步。第 2 步:更新 values.yaml 部分以获取其他脚本:
additionalScripts: create: true data: add_config.sh: |-附加脚本:创建:真实数据: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.第 3 步:为每个集群创建不同的 kubeConfigtestcluster 部分。
kubeConfigtestcluster: enabled: true kubeConfigtestcluster: 启用: true
step 4: update your halyard.yaml template file to mount the secret created in step 1, into the halyard pod.第 4 步:更新您的 halyard.yaml 模板文件,以将第 1 步中创建的密钥安装到 halyard pod 中。
step 5: upgrade or create a new helm deployment.第 5 步:升级或创建新的 helm 部署。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.