In a namespace foo
there is an existing pod running
$ kubectl get pods -n foo
NAME READY STATUS RESTARTS AGE
hello-1816639685-xejyk 1/1 Running 0 6d3h
How can we duplicate the hello
pod so that we can try out things in this duplicated pod without affecting the original pod?
2
Answers
You can get the pod manifest using YAML output from kubectl and create a new pod based on that specification.
For example
kubectl get pod hello-1816639685-xejyk -n foo -o yaml
You need to use a different name or namespace, since the name must be unique.
Based on the naming convention, that pod looks like it’s a deployment, so you should be able to scale up an additional replica (or replicas) using
However, this is assuming you haven’t added something like a persistent disk to the deployment (which then won’t work with the additional replica)