geerlingguy / kubernetes-101

Kubernetes 101 - by Jeff Geerling
https://kube101.jeffgeerling.com/
MIT License
555 stars 166 forks source link

Episode 3 - changing number of replicas does not work #37

Closed CaptainTyphoo closed 2 years ago

CaptainTyphoo commented 2 years ago

When I change the replicas number, the command returns that the deployment was edited:

$ kubectl edit deployment hello-go
deployment.apps/hello-go edited

but I cannot see any additional pods getting rolled out:

$ kubectl get deployment hello-go
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
hello-go   1/1     1            1           86m

If I use the command $ kubectl edit deployment hello-go to check the configuration, I see that the replicas line has been changed back to 1.

Additional info:

$ kubectl describe deployment hello-go
Name:                   hello-go
Namespace:              default
CreationTimestamp:      Sat, 08 Jan 2022 15:29:02 +0000
Labels:                 app=hello-go
Annotations:            deployment.kubernetes.io/revision: 2
Selector:               app=hello-go
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=hello-go
  Containers:
   kube101-go:
    Image:        geerlingguy/kube101:hello-go
    Port:         <none>
    Host Port:    <none>
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   hello-go-7459b5c854 (1/1 replicas created)
Events:          <none>
$ kubectl get all --selector app=hello-go
NAME                            READY   STATUS    RESTARTS   AGE
pod/hello-go-7459b5c854-rmrrc   1/1     Running   0          80m

NAME               TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
service/hello-go   NodePort   10.107.98.168   <none>        80:32699/TCP   77m

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/hello-go   1/1     1            1           86m

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/hello-go-5944979865   0         0         0       86m
replicaset.apps/hello-go-7459b5c854   1         1         1       80m

OS: Debian 10.11 minikube: v1.24.0 Docker: 20.10.8

CaptainTyphoo commented 2 years ago

I figured it out on my own. I was editing the replicas line in the the status section of the configuration. (Why is there a read-only part in the configuration???)

@geerlingguy Could you maybe add a note in the book that says into which section (spec) the modifications should go?

stale[bot] commented 2 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 2 years ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.