7 changed files with 272 additions and 1 deletions
@ -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" |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -0,0 +1,7 @@ |
|||
apiVersion: storage.k8s.io/v1 |
|||
kind: StorageClass |
|||
metadata: |
|||
name: managed-nfs-storage |
|||
provisioner: fuseim.pri/ifs |
|||
parameters: |
|||
archiveOnDelete: "false" |
Loading…
Reference in new issue