apiVersion: apps/v1
kind: Deployment
metadata:
  name: nacos-deployment
  namespace: bcx-opm
  labels:
    app: nacos
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nacos
  template:
    metadata:
      labels:
        app: nacos
    spec:
      containers:
        - name: nacos
          image: nacos/nacos-server:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8848
              name: client
            - containerPort: 9848
              name: client-rpc
            - containerPort: 9849
              name: raft-rpc
            - containerPort: 7848
              name: old-raft-rpc
          env:
            - name: MODE
              value: "standalone"      
---
apiVersion: v1
kind: Service
metadata:
  name: nacos-service
  namespace: bcx-opm
  labels:
    app: nacos
spec:
  type: ClusterIP
  ports:
    - port: 8848
      name: server
      targetPort: 8848
    - port: 9848
      name: client-rpc
      targetPort: 9848
    - port: 9849
      name: raft-rpc
      targetPort: 9849
    ## 兼容1.4.x版本的选举端口
    - port: 7848
      name: old-raft-rpc
      targetPort: 7848
  selector:
    app: nacos