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
| [root@pool1 k8s_yaml] apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 volumeMounts: - name: nfs-volume mountPath: /usr/share/nginx/html volumes: - name: nfs-volume nfs: server: 172.16.1.20 path: /data/k8s_data [root@pool1 k8s_yaml] deployment.apps/nginx-deployment created [root@pool1 k8s_yaml] NAME READY STATUS RESTARTS AGE hostpath-pod 1/1 Running 0 27m nginx-deployment-7454fb7b-bhcpn 1/1 Running 0 106s nginx-deployment-7454fb7b-phhkk 1/1 Running 0 106s nginx-deployment-7454fb7b-q9qh8 1/1 Running 0 106s [root@pool1 k8s_yaml] my is nfs volume! EOF [root@pool1 k8s_yaml] service/nginx-deployment exposed [root@pool1 k8s_yaml] NAME ENDPOINTS AGE kubernetes 172.16.1.20:6443 5h44m nginx-deployment 10.244.206.17:80,10.244.52.197:80,10.244.52.198:80 3s [root@pool1 k8s_yaml] NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 5h44m nginx-deployment ClusterIP 10.108.89.236 <none> 80/TCP 12s [root@pool1 k8s_yaml] my is nfs volume!
|