How to do it...

At the beginning, take a look at the Deployment you just created and its ReplicaSet by executing the following code block:

$ kubectl describe deployment simple-nginx
Name: simple-nginx
Namespace: default
CreationTimestamp: Fri, 04 May 2018 12:14:21 -0400
Labels: env=test
project=My-Happy-Web
role=frontend
Annotations: deployment.kubernetes.io/revision=1
Selector: env=test,project=My-Happy-Web,role=frontend
Replicas: 5 desired | 5 updated | 5 total | 5 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 1 max unavailable, 1 max surge
Pod Template:
Labels: env=test
project=My-Happy-Web
role=frontend
Containers:
simple-nginx:
Image: nginx
Port: 80/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: simple-nginx-585f6cddcd (5/5 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 1h deployment-controller Scaled up replica set simple-nginx-585f6cddcd to 5
// rs is the abbreviated resource key of replicaset
$ kubectl get rs
NAME DESIRED CURRENT READY AGE
simple-nginx-585f6cddcd 5 5 5 1h

Based on the preceding output, we know that the default updating strategy of deployment is rolling-update. Also, there is a single ReplicaSet named <Deployment Name>-<hex decimal hash> that is created along with the Deployment.

Next, check the content of the current Service endpoint for the sake of verifying our update later:

// record the cluster IP of Service "nginx-service"
$ export SERVICE_URL=$(kubectl get svc | grep nginx-service | awk '{print $3}'):8080

// For minikube environment only, record the VM host IP and port for the service
$ export SERVICE_URL=$(minikube service nginx-service --url)
$ curl $SERVICE_URL | grep "title"
<title>Welcome to nginx!</title>

We will get the welcome message in the title of the HTML response with the original nginx image.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.89.18