# Namespace
apiVersion: v1
kind: Namespace
metadata:
  name: dubbo-quickstart
---
apiVersion: v1
kind: Namespace
metadata:
  name: dubbo-system
---

# Nacos
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nacos
  namespace: dubbo-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nacos
  template:
    metadata:
      labels:
        app: nacos
    spec:
      containers:
        - name: consumer
          image: nacos-registry.cn-hangzhou.cr.aliyuncs.com/nacos/nacos-server:v2.1.2
          imagePullPolicy: Always
          resources:
            requests:
              memory: "2Gi"
              cpu: "500m"
          ports:
            - containerPort: 8848
              name: client
            - containerPort: 9848
              name: client-rpc
          env:
            - name: NACOS_SERVER_PORT
              value: "8848"
            - name: NACOS_APPLICATION_PORT
              value: "8848"
            - name: PREFER_HOST_MODE
              value: "hostname"
            - name: MODE
              value: "standalone"
            - name: NACOS_AUTH_ENABLE
              value: "true"
---
apiVersion: v1
kind: Service
metadata:
  name: nacos
  namespace: dubbo-system
spec:
  type: ClusterIP
  sessionAffinity: None
  selector:
    app: nacos
  ports:
    - port: 8848
      name: server
      targetPort: 8848
    - port: 9848
      name: client-rpc
      targetPort: 9848
---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: quickstart
  namespace: dubbo-quickstart
spec:
  replicas: 1
  selector:
    matchLabels:
      app: quickstart
  template:
    metadata:
      labels:
        app: quickstart
    spec:
      containers:
        - name: quickstart
          image: sca-registry.cn-hangzhou.cr.aliyuncs.com/dubbo/dubbo-quickstart:1.0
          imagePullPolicy: Always
          ports:
            - name: dubbo
              containerPort: 50051
              protocol: TCP
            - name: dubbo-qos
              containerPort: 22222
              protocol: TCP
          env:
            - name: JAVA_TOOL_OPTIONS
              value: "-Dnacos.address=nacos.dubbo-system.svc"
---

apiVersion: v1
kind: Service
metadata:
  name: quickstart
  namespace: dubbo-quickstart
spec:
  selector:
    app: quickstart
  ports:
    - name: tcp
      port: 50051
      targetPort: 50051
    - name: http
      port: 22222
      targetPort: 22222
---

