官方文档:
https://docs.koderover.com/zadig/
export IP=<IP> # 集群任一节点公网 IP,用于访问 Zadig 系统 export PORT=<PORT> # 随机填写 30000 - 32767 区间的任一端口,如果安装过程中,发现端口占用,换一个端口再尝试 curl -SsL https://download.koderover.com/install?type=standard| bash |
提前安装helm
wget https://get.helm.sh/helm-v3.12.0-linux-amd64.tar.gz tar -zxvf helm-v3.12.0-linux-amd64.tar.gz cp linux-amd64/helm /usr/bin helm version |
搭建nfs-server,我的nfs-server 的服务器地址是192.168
.
31.105
yum install nfs* -y vi /etc/exports /data/nfs *(rw,sync,no_subtree_check,no_root_squash) systemctl enable --now nfs |
提前设置storage class,下面nfs服务器地址修改下,default名称空间自定
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: nfs-storage annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: k8s-sigs.io/nfs-subdir-external-provisioner allowVolumeExpansion: True parameters: archiveOnDelete: "true" ## 删除pv的时候,pv的内容是否要备份 --- apiVersion: apps/v1 kind: Deployment metadata: name: nfs-client-provisioner labels: app: nfs-client-provisioner # replace with namespace where provisioner is deployed namespace: default spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: nfs-client-provisioner template: metadata: labels: app: nfs-client-provisioner spec: serviceAccountName: nfs-client-provisioner containers: - name: nfs-client-provisioner image: registry.cn-hangzhou.aliyuncs.com/zhengyu1992/nfs-subdir-external-provisioner:v4.0.2 # resources: # limits: # cpu: 10m # requests: # cpu: 10m volumeMounts: - name: nfs-client-root mountPath: /persistentvolumes env: - name: PROVISIONER_NAME value: k8s-sigs.io/nfs-subdir-external-provisioner - name: NFS_SERVER value: 192.168.31.105 ## 指定自己nfs服务器地址 - name: NFS_PATH value: /data/nfs/ ## nfs服务器共享的目录 volumes: - name: nfs-client-root nfs: server: 192.168.31.105 path: /data/nfs/ --- apiVersion: v1 kind: ServiceAccount metadata: name: nfs-client-provisioner # replace with namespace where provisioner is deployed namespace: default --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: nfs-client-provisioner-runner rules: - apiGroups: [""] resources: ["nodes"] verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["persistentvolumes"] verbs: ["get", "list", "watch", "create", "delete"] - apiGroups: [""] resources: ["persistentvolumeclaims"] verbs: ["get", "list", "watch", "update"] - apiGroups: ["storage.k8s.io"] resources: ["storageclasses"] verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["events"] verbs: ["create", "update", "patch"] --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: run-nfs-client-provisioner subjects: - kind: ServiceAccount name: nfs-client-provisioner # replace with namespace where provisioner is deployed namespace: default roleRef: kind: ClusterRole name: nfs-client-provisioner-runner apiGroup: rbac.authorization.k8s.io --- kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: leader-locking-nfs-client-provisioner # replace with namespace where provisioner is deployed namespace: default rules: - apiGroups: [""] resources: ["endpoints"] verbs: ["get", "list", "watch", "create", "update", "patch"] --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: leader-locking-nfs-client-provisioner # replace with namespace where provisioner is deployed namespace: default subjects: - kind: ServiceAccount name: nfs-client-provisioner # replace with namespace where provisioner is deployed namespace: default roleRef: kind: Role name: leader-locking-nfs-client-provisioner apiGroup: rbac.authorization.k8s.io |
上面的yaml文件将创建一个nfs-storage的存储类,并设置为默认
如果有多个默认存储类,需要将nfs-storage设置为默认存储(不然zadig的mysql,mongodb,minio的pv创建不出来)
执行以下命令查看当前所有存储类
kubectl get sc kubectl patch storageclass 其他存储类名称 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":null}}}' kubectl patch storageclass nfs-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' |
zadig安装完成后记得保存页面上的key信息方便下次迁移升级
zadig安装完成后默认路径是IP+端口的方式,修改下面两个configmap中的内容改成域名然后重启两个deployment
kubectl -n zadig edit cm warpdrive-config kubectl -n zadig edit cm aslan-config kubectl -n zadig rollout restart deploy warpdrive kubectl -n zadig rollout restart deploy aslan |
创建ingress
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: nginx.ingress.kubernetes.io/ssl-redirect: 'true' name: zadig-web namespace: zadig spec: ingressClassName: nginx rules: - host: zadig.uenpay.com http: paths: - backend: service: name: gateway-proxy port: number: 80 path: / pathType: ImplementationSpecific tls: - hosts: - zadig.uenpay.com secretName: uenpay.com |