diff --git a/esua-epdc/k8s/kongcun/app-master/mysql/mysql-pvc.yml b/esua-epdc/k8s/kongcun/app-master/mysql/mysql-pvc.yml index 0f0cae304..f3373ae78 100644 --- a/esua-epdc/k8s/kongcun/app-master/mysql/mysql-pvc.yml +++ b/esua-epdc/k8s/kongcun/app-master/mysql/mysql-pvc.yml @@ -11,7 +11,7 @@ spec: resources: requests: storage: 100Gi - storageClassName: nfs + storageClassName: managed-nfs-storage selector: matchLabels: pv: mysql-master-pv diff --git a/esua-epdc/k8s/kongcun/app-master/nacos/nacos-cm.yml b/esua-epdc/k8s/kongcun/app-master/nacos/nacos-cm.yml new file mode 100644 index 000000000..e36532865 --- /dev/null +++ b/esua-epdc/k8s/kongcun/app-master/nacos/nacos-cm.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nacos-cm + namespace: epdc-nacos +data: + mysql.master.db.name: "nacos_devtest" + mysql.master.port: "3306" + mysql.slave.port: "3306" + mysql.master.user: "nacos" + mysql.master.password: "nacos" diff --git a/esua-epdc/k8s/kongcun/app-master/nacos/nacos-pvc-nfs.yml b/esua-epdc/k8s/kongcun/app-master/nacos/nacos-pvc-nfs.yml new file mode 100644 index 000000000..ac857b09f --- /dev/null +++ b/esua-epdc/k8s/kongcun/app-master/nacos/nacos-pvc-nfs.yml @@ -0,0 +1,132 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: nacos +spec: + serviceName: nacos-headless + replicas: 2 + template: + metadata: + labels: + app: nacos + annotations: + pod.alpha.kubernetes.io/initialized: "true" + spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: "app" + operator: In + values: + - nacos + topologyKey: "kubernetes.io/hostname" + serviceAccountName: nfs-client-provisioner + initContainers: + - name: peer-finder-plugin-install + image: nacos/nacos-peer-finder-plugin:latest + imagePullPolicy: Always + volumeMounts: + - mountPath: "/home/nacos/plugins/peer-finder" + name: plugindir + containers: + - name: nacos + imagePullPolicy: Always + image: nacos/nacos-server:latest + resources: + requests: + memory: "2Gi" + cpu: "500m" + ports: + - containerPort: 8848 + name: client-port + env: + - name: NACOS_REPLICAS + value: "3" + - name: SERVICE_NAME + value: "nacos-headless" + - name: POD_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: MYSQL_MASTER_SERVICE_DB_NAME + valueFrom: + configMapKeyRef: + name: nacos-cm + key: mysql.master.db.name + - name: MYSQL_MASTER_SERVICE_PORT + valueFrom: + configMapKeyRef: + name: nacos-cm + key: mysql.master.port + - name: MYSQL_SLAVE_SERVICE_PORT + valueFrom: + configMapKeyRef: + name: nacos-cm + key: mysql.slave.port + - name: MYSQL_MASTER_SERVICE_USER + valueFrom: + configMapKeyRef: + name: nacos-cm + key: mysql.master.user + - name: MYSQL_MASTER_SERVICE_PASSWORD + valueFrom: + configMapKeyRef: + name: nacos-cm + key: mysql.master.password + - name: NACOS_SERVER_PORT + value: "8848" + - name: PREFER_HOST_MODE + value: "hostname" + readinessProbe: + httpGet: + port: client-port + path: /nacos/v1/console/health/readiness + initialDelaySeconds: 60 + timeoutSeconds: 3 + livenessProbe: + httpGet: + port: client-port + path: /nacos/v1/console/health/liveness + initialDelaySeconds: 60 + timeoutSeconds: 3 + volumeMounts: + - name: plugindir + mountPath: /home/nacos/plugins/peer-finder + - name: datadir + mountPath: /home/nacos/data + - name: logdir + mountPath: /home/nacos/logs + volumeClaimTemplates: + - metadata: + name: plugindir + annotations: + volume.beta.kubernetes.io/storage-class: "managed-nfs-storage" + spec: + accessModes: [ "ReadWriteMany" ] + resources: + requests: + storage: 5Gi + - metadata: + name: datadir + annotations: + volume.beta.kubernetes.io/storage-class: "managed-nfs-storage" + spec: + accessModes: [ "ReadWriteMany" ] + resources: + requests: + storage: 5Gi + - metadata: + name: logdir + annotations: + volume.beta.kubernetes.io/storage-class: "managed-nfs-storage" + spec: + accessModes: [ "ReadWriteMany" ] + resources: + requests: + storage: 5Gi + selector: + matchLabels: + app: nacos diff --git a/esua-epdc/k8s/kongcun/app-master/nacos/nacos-svc.yml b/esua-epdc/k8s/kongcun/app-master/nacos/nacos-svc.yml new file mode 100644 index 000000000..ec1af420a --- /dev/null +++ b/esua-epdc/k8s/kongcun/app-master/nacos/nacos-svc.yml @@ -0,0 +1,18 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: nacos-headless + namespace: epdc-nacos + labels: + app: nacos + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" +spec: + ports: + - port: 8848 + name: server + targetPort: 8848 + clusterIP: None + selector: + app: nacos diff --git a/esua-epdc/k8s/kongcun/app-master/nfs/nfs-deployment.yml b/esua-epdc/k8s/kongcun/app-master/nfs/nfs-deployment.yml new file mode 100644 index 000000000..083d5c4f5 --- /dev/null +++ b/esua-epdc/k8s/kongcun/app-master/nfs/nfs-deployment.yml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: nfs-client-provisioner + +--- + +kind: Deployment +apiVersion: apps/v1 +metadata: + name: nfs-client-provisioner +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: nfs-client-provisioner + template: + metadata: + labels: + app: nfs-client-provisioner + spec: + serviceAccount: nfs-client-provisioner + containers: + - name: nfs-client-provisioner + image: quay.io/external_storage/nfs-client-provisioner:latest + volumeMounts: + - name: nfs-client-root + mountPath: /persistentvolumes + env: + - name: PROVISIONER_NAME + value: fuseim.pri/ifs + - name: NFS_SERVER + value: 172.16.0.7 + - name: NFS_PATH + value: /mnt/nfs/data + volumes: + - name: nfs-client-root + nfs: + server: 172.16.0.7 + path: /mnt/nfs/data diff --git a/esua-epdc/k8s/kongcun/app-master/nfs/nfs-rbac.yml b/esua-epdc/k8s/kongcun/app-master/nfs/nfs-rbac.yml new file mode 100644 index 000000000..d39a3b088 --- /dev/null +++ b/esua-epdc/k8s/kongcun/app-master/nfs/nfs-rbac.yml @@ -0,0 +1,61 @@ +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: nfs-client-provisioner-runner +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["endpoints"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + - 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 + 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 +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 +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner + # replace with namespace where provisioner is deployed +roleRef: + kind: Role + name: leader-locking-nfs-client-provisioner + apiGroup: rbac.authorization.k8s.io diff --git a/esua-epdc/k8s/kongcun/app-master/nfs/storageclass-nfs.yml b/esua-epdc/k8s/kongcun/app-master/nfs/storageclass-nfs.yml new file mode 100644 index 000000000..2c81f17b1 --- /dev/null +++ b/esua-epdc/k8s/kongcun/app-master/nfs/storageclass-nfs.yml @@ -0,0 +1,7 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: managed-nfs-storage +provisioner: fuseim.pri/ifs +parameters: + archiveOnDelete: "false"