below we are using replication controller to stick Node2 to be scheduled
root@master:/tmp# cat test-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: myapp-rc
labels:
app: myapp
type: front-end
spec:
template:
metadata:
name: myapp-rc
labels:
app: myapp
type: front-end
spec:
nodeName: node2.ckalab4.com
containers:
- name: nginx-container
image: nginx
replicas: 10
root@master:/tmp#
kubectl scale –replicas=20 rc/myapp-rc
if we see above all are created in Node2 .
update wrong nodeName and try to apply
nodeName: node2.ckalab4.com
if we apply now the nodes will bring back to 10 as it was the initial running pods .
root@master:/tmpk apply -f test-rc.yaml
Warning: resource replicationcontrollers/myapp-rc is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
replicationcontroller/myapp-rc configured
root@master:/tmp#
root@master:/tmp# k get pods -o wide -w
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
myapp-rc-58rnq 0/1 Pending 0 20s <none> node2.ckalab4.comm <none> <none>
myapp-rc-828v9 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-898nv 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-8xbpk 0/1 Pending 0 20s <none> node2.ckalab4.comm <none> <none>
myapp-rc-gfvlr 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-k4ptk 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-qxsmk 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rgbqp 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rjc4v 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rjxrn 0/1 Pending 0 21s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rjc4v 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rjc4v 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-pzcpj 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-rjc4v 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-8xbpk 0/1 Failed 0 40s <none> node2.ckalab4.comm <none> <none>
myapp-rc-8xbpk 0/1 Terminating 0 40s <none> node2.ckalab4.comm <none> <none>
myapp-rc-49zjx 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-8xbpk 0/1 Terminating 0 40s <none> node2.ckalab4.comm <none> <none>
myapp-rc-pzcpj 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-58rnq 0/1 Failed 0 40s <none> node2.ckalab4.comm <none> <none>
myapp-rc-f5w4r 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-58rnq 0/1 Terminating 0 40s <none> node2.ckalab4.comm <none> <none>
myapp-rc-58rnq 0/1 Terminating 0 40s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rgbqp 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-dcnd4 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-rgbqp 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rgbqp 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-gfvlr 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-gfvlr 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-ll7db 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-gfvlr 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-898nv 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-49zjx 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-898nv 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-czgp8 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-898nv 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-ll7db 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-828v9 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-828v9 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-828v9 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-f8g7z 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-k4ptk 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-f5w4r 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-k4ptk 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-9kt5g 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-k4ptk 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-dcnd4 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-qxsmk 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-qv52q 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-qxsmk 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-qxsmk 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rjxrn 0/1 Failed 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-czgp8 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-lbrs2 0/1 Pending 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-rjxrn 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-rjxrn 0/1 Terminating 0 41s <none> node2.ckalab4.comm <none> <none>
myapp-rc-f8g7z 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-9kt5g 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-lbrs2 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-qv52q 0/1 ContainerCreating 0 0s <none> node2.ckalab4.com <none> <none>
myapp-rc-pzcpj 1/1 Running 0 4s 10.244.64.1 node2.ckalab4.com <none> <none>
myapp-rc-qv52q 1/1 Running 0 6s 10.244.64.8 node2.ckalab4.com <none> <none>
myapp-rc-czgp8 1/1 Running 0 8s 10.244.64.2 node2.ckalab4.com <none> <none>
myapp-rc-9kt5g 1/1 Running 0 9s 10.244.64.6 node2.ckalab4.com <none> <none>
myapp-rc-lbrs2 1/1 Running 0 11s 10.244.64.10 node2.ckalab4.com <none> <none>
myapp-rc-49zjx 1/1 Running 0 13s 10.244.64.3 node2.ckalab4.com <none> <none>
myapp-rc-f5w4r 1/1 Running 0 14s 10.244.64.5 node2.ckalab4.com <none> <none>
myapp-rc-f8g7z 1/1 Running 0 16s 10.244.64.9 node2.ckalab4.com <none> <none>
myapp-rc-dcnd4 1/1 Running 0 17s 10.244.64.4 node2.ckalab4.com <none> <none>
myapp-rc-ll7db 1/1 Running 0 19s 10.244.64.7 node2.ckalab4.com <none> <none>
^Z
[2]+ Stopped kubectl get pods -o wide -w
root@master:/tmp# k get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
myapp-rc-49zjx 1/1 Running 0 28s 10.244.64.3 node2.ckalab4.com <none> <none>
myapp-rc-9kt5g 1/1 Running 0 28s 10.244.64.6 node2.ckalab4.com <none> <none>
myapp-rc-czgp8 1/1 Running 0 28s 10.244.64.2 node2.ckalab4.com <none> <none>
myapp-rc-dcnd4 1/1 Running 0 28s 10.244.64.4 node2.ckalab4.com <none> <none>
myapp-rc-f5w4r 1/1 Running 0 28s 10.244.64.5 node2.ckalab4.com <none> <none>
myapp-rc-f8g7z 1/1 Running 0 28s 10.244.64.9 node2.ckalab4.com <none> <none>
myapp-rc-lbrs2 1/1 Running 0 28s 10.244.64.10 node2.ckalab4.com <none> <none>
myapp-rc-ll7db 1/1 Running 0 28s 10.244.64.7 node2.ckalab4.com <none> <none>
myapp-rc-pzcpj 1/1 Running 0 28s 10.244.64.1 node2.ckalab4.com <none> <none>
myapp-rc-qv52q 1/1 Running 0 28s 10.244.64.8 node2.ckalab4.com <none> <none>
root@master:/tmp#
root@master:/tmp#
root@master:/tmp#