@@ -82,33 +82,32 @@ $ kubectl get pods
82
82
83
83
## Create a Deployment
84
84
85
- The folowing example will create a Deployment with 3 replicas of NGINX base image. Let's begin with the template:
86
-
87
- apiVersion: extensions/v1beta1
88
- kind: Deployment # kubernetes object type
89
- metadata:
90
- name: nginx-deployment # deployment name
91
- spec:
92
- replicas: 3 # number of replicas
93
- template:
94
- metadata:
95
- labels:
96
- app: nginx # pod labels
97
- spec:
98
- containers:
99
- - name: nginx # container name
100
- image: nginx:1.12.1 # nginx image
101
- imagePullPolicy: IfNotPresent # if exists, will not pull new image
102
- ports: # container and host port assignments
103
- - containerPort: 80
104
- - containerPort: 443
105
-
106
- This deployment will create 3 instances of NGINX image.
85
+ Say, we need to create 3 instances of NGINX image.
107
86
108
87
Run the following command to create Deployment:
109
88
110
- $ kubectl create -f nginx-deployment.yaml
111
- deployment "nginx-deployment" created
89
+
90
+ ```
91
+ $ kubectl create -f nginx-deployment.yaml
92
+ ```
93
+
94
+ ```
95
+ [node1 ~]$ kubectl get po,svc,deploy
96
+ NAME READY STATUS RESTARTS AGE
97
+ pod/nginx-deployment-84bfcbdd5-2256x 1/1 Running 0 3m
98
+ pod/nginx-deployment-84bfcbdd5-2dcn6 1/1 Running 0 3m
99
+ pod/nginx-deployment-84bfcbdd5-sqrjz 1/1 Running 0 3m
100
+ pod/nginx-pod 1/1 Running 0 9m
101
+
102
+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
103
+ service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19m
104
+ service/my-nginx ClusterIP 10.104.151.230 <none> 80/TCP 13m
105
+ service/nginx-deployment ClusterIP 10.99.154.211 <none> 80/TCP 2m
106
+
107
+ NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
108
+ deployment.extensions/nginx-deployment 3 3 3 3 3m
109
+ [node1 ~]$
110
+ ```
112
111
113
112
114
113
## Verify that the pod came up fine:
0 commit comments