k8s 部署mysq、nacos yaml
以下是一个示例的k8s部署MySQL和Nacos的yaml文件:
MySQL.yaml:
apiVersion: v1
kind: Service
metadata:
name: mysql-service
labels:
app: mysql
spec:
ports:
- port: 3306
selector:
app: mysql
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-deployment
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:latest
ports:
- containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
value: password
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pvc
Nacos.yaml:
apiVersion: v1
kind: Service
metadata:
name: nacos-service
labels:
app: nacos
spec:
ports:
- port: 8848
selector:
app: nacos
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nacos-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nacos
template:
metadata:
labels:
app: nacos
spec:
containers:
- name: nacos
image: nacos/nacos-server:latest
ports:
- containerPort: 8848
env:
- name: MODE
value: standalone
volumeMounts:
- name: nacos-persistent-storage
mountPath: /home/nacos/init.d/custom.properties
subPath: custom.properties
volumes:
- name: nacos-persistent-storage
configMap:
name: nacos-configmap
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nacos-configmap
data:
custom.properties: |-
nacos.cmdb.dumpTaskInterval=3600000
nacos.cmdb.label.taskInterval=30000
nacos.cmdb.event.taskInterval=10000
nacos.cmdb.snapshot.taskInterval=10000
nacos.core.auth.enabled=false
nacos.core.auth.caching.enabled=false
nacos.core.auth.caching.interval=10000
nacos.naming.data.warmup=true
nacos.naming.expireInstance=true
nacos.naming.distro.task.interval=20000
nacos.naming.distro.task.retryTime=5000
nacos.naming.distro.task.batchSize=1000
nacos.naming.distro.task.processTaskInterval=2000
nacos.naming.distro.task.removeTaskInterval=2000
nacos.naming.log.serviceName=naming
nacos.naming.log.namespaceId=public
nacos.naming.log.groupName=DEFAULT_GROUP
nacos.naming.log.clusterName=DEFAULT
nacos.naming.healthcheck.enabled=true
nacos.naming.healthcheck.interval=5000
nacos.naming.healthcheck.times=3
nacos.naming.healthcheck.noavailable.deadline=60000
nacos.naming.data.warmup=true
nacos.naming.expireInstance=true
nacos.naming.distro.task.interval=20000
nacos.naming.distro.task.retryTime=5000
nacos.naming.distro.task.batchSize=1000
nacos.naming.distro.task.processTaskInterval=2000
nacos.naming.distro.task.removeTaskInterval=2000
nacos.naming.log.serviceName=naming
nacos.naming.log.namespaceId=public
nacos.naming.log.groupName=DEFAULT_GROUP
nacos.naming.log.clusterName=DEFAULT
nacos.naming.healthcheck.enabled=true
nacos.naming.healthcheck.interval=5000
nacos.naming.healthcheck.times=3
nacos.naming.healthcheck.noavailable.deadline=60000
你可以在Kubernetes集群中使用这些yaml文件来部署MySQL和Nacos。
原文地址: https://www.cveoy.top/t/topic/jc01 著作权归作者所有。请勿转载和采集!