apiVersion: apps/v1
kind: Deployment
metadata:
  name: nacos-pod
  namespace: devops
spec:
  selector:
    matchLabels:
      app: nacos-pod
  replicas: 1
  template:
    metadata:
      labels:
        service: nacos-pod
        app: nacos-pod
    spec:
      nodeName: microk8sslave1 # 部署到指定的node节点
      containers:
      - name: nacos-server
        image: nacos/nacos-server:latest
        imagePullPolicy: Always
        ports:
          - containerPort: 8848
            name: "nacos-port"
          - containerPort: 9848  
            name: "nacossynchport"
          - containerPort: 9849
            name: "nacosgrpcport"
        resources:
          limits:
            memory: "3Gi"
            cpu: "1000m"
        env:
          - name: SPRING_DATASOURCE_PLATFORM
            value: mysql
          - name: MYSQL_SERVICE_HOST
            value: 192.168.31.175
          - name: MYSQL_SERVICE_DB_NAME
            value: nacos
          - name: MYSQL_SERVICE_PORT
            value: "3306"
          - name: MYSQL_SERVICE_USER
            value: root
          - name: MYSQL_SERVICE_PASSWORD
            value: P@ssW0rd
          - name: MYSQL_SERVICE_DB_PARAM
            value: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&serverTimezone=UTC
          - name: MODE
            value: standalone
      volumes:
      - name: nacostime
        hostPath:
          path: /etc/localtime


