1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| [root@master ~] [root@master nacos] --- apiVersion: v1 kind: Service metadata: name: nacos-prod labels: app: nacos-prod spec: type: NodePort ports: - port: 8848 name: server targetPort: 8848 nodePort: 31048 - port: 9848 name: client-rpc targetPort: 9848 - port: 9849 name: raft-rpc targetPort: 9849 - port: 7848 name: old-raft-rpc targetPort: 7848 selector: app: nacos-prod --- apiVersion: v1 kind: ConfigMap metadata: name: nacos-cm data: mysql.db.name: "nacos_prod" mysql.port: "3306" mysql.user: "nacos" mysql.password: "nacos" --- apiVersion: apps/v1 kind: Deployment metadata: name: nacos-prod spec: replicas: 1 template: metadata: labels: app: nacos-prod annotations: pod.alpha.kubernetes.io/initialized: "true" spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: "app" operator: In values: - nacos-prod topologyKey: "kubernetes.io/hostname"
containers: - name: k8snacos imagePullPolicy: Always image: nacos/nacos-server:latest resources: requests: memory: "1Gi" cpu: "500m" ports: - containerPort: 8848 name: client - containerPort: 9848 name: client-rpc - containerPort: 9849 name: raft-rpc - containerPort: 7848 name: old-raft-rpc env: - name: NACOS_REPLICAS value: "1" - name: MYSQL_SERVICE_DB_NAME valueFrom: configMapKeyRef: name: nacos-cm key: mysql.db.name - name: MYSQL_SERVICE_PORT valueFrom: configMapKeyRef: name: nacos-cm key: mysql.port - name: MYSQL_SERVICE_USER valueFrom: configMapKeyRef: name: nacos-cm key: mysql.user - name: MYSQL_SERVICE_PASSWORD valueFrom: configMapKeyRef: name: nacos-cm key: mysql.password - name: NACOS_SERVER_PORT value: "8848" - name: NACOS_APPLICATION_PORT value: "8848" - name: PREFER_HOST_MODE value: "hostname" - name: MODE value: "standalone" selector: matchLabels: app: nacos-prod
[root@master nacos] NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nacos-prod-55487457cd-vpjkn 1/1 Running 0 6m7s 10.244.1.3 node01 <none> <none> [root@master nacos] NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 7d23h nacos-prod NodePort 10.102.139.65 <none> 8848:31048/TCP,9848:31522/TCP,9849:32267/TCP,7848:31939/TCP 43s
http://IP + 31048/nacos
|