视频地址:https://www.bilibili.com/video/BV1eS4y1F7pN/
0. 准备一个Kubernetes集群(略)
$ kubectl get nodes NAME STATUS ROLES AGE VERSION myoci.site Ready control-plane,master 3d12h v1.21.4
1. 为了更方便外部访问,安装Nginx Ingress
kubectl label node myoci.site ingress-ready=true
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
2. 使用Docker容器安装Halyard
mkdir ~/.hal docker run -d --name halyard --restart=always -v ~/.hal:/home/spinnaker/.hal -v ~/.kube:/home/spinnaker/.kube gcr.io/spinnaker-marketplace/halyard:stable
确认安装,
docker exec -it halyard bash
hal -v
3. 选择云提供商
hal config provider kubernetes enable
添加Kubernetes集群账户
hal config provider kubernetes account add spinnaker-admin --context $(kubectl config current-context)
选择运行环境
hal config deploy edit --account-name spinnaker-admin --type distributed --location spinnaker
4. 部署Storageclass(可选)
Kubernetes集群需要有Storageclass动态提供存储,如果没有的话需要创建一个默认的Storageclass。
安装nfs-server
sudo su - echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports mkdir -p /nfs/data sudo yum install -y nfs-utils systemctl enable rpcbind --now systemctl enable nfs-server --now # 设置生效 exportfs -r exportfs
通过nfs-subdir-external-provisioner创建Storageclass
helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/ helm repo update
helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \ --set nfs.server=xxx.xxx.xxx.xxx \ --set nfs.path=/nfs/data
将nfs-client设置为默认storageclass
kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
5. 选择存储方式(本例使用minio)
kubectl create ns minio
安装Minio
helm repo add minio https://helm.min.io/ helm install -n minio --generate-name minio/minio
获取ACCESS_KEY和SECRET_KEY
kubectl -n minio get secret minio-
-o jsonpath="{.data.accesskey}" | base64 -d kubectl -n minio get secret minio-
-o jsonpath="{.data.secretkey}" | base64 -d
配置Minio存储
hal config storage s3 edit --endpoint http://minio-
.minio.svc.cluster.local:9000 --access-key-id
--secret-access-key
--path-style-access true
hal config storage edit --type s3
Minio不支持对象版本控制,需要在Spinnaker中将其禁用
mkdir -p ~/.hal/default/profiles/ cat > ~/.hal/default/profiles/front50-local.yaml <
6. 部署Spinnaker
hal version list hal config version edit --version 1.26.6
执行部署(如果发生错误,再次执行一次)
hal deploy apply
确认
kubectl get pods -n spinnaker
部署Ingress
cat <
修改Spinnaker Deck和Gate的域名配置
hal config security ui edit --override-base-url http://spinnaker.spinbook.local hal config security api edit --override-base-url http://spinnaker-gate.spinbook.local
重新部署Spinnaker,使配置生效
hal deploy apply
修改/etc/hosts
sudo vi /etc/hosts --- add 127.0.0.1 spinnaker-gate.spinbook.local spinnaker.spinbook.local ---
7. 访问Spinnaker
打开浏览器,访问http://spinnaker.spinbook.local
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7SqFEzsq-02)(images/image-.png)]
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/217546.html原文链接:https://javaforall.net
