Day-10- Behind the scenes with Kubernetes 🔧
Greetings everyone! I am Currently preparing for the CKA exam and here are my todays share of insights and observations which might come in handy for folks working with Kubernetes.
How to set resource quotas of new pods in a Kubernetes cluster🚀
It can be done for the newly created pods through two ways:
1. Imperative command: (At deployment level)
Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
2. Declarative approach: Manifest file: (at pod level)
But what about already existing running pods in the cluster?
Although Kubernetes doesn’t allow it, but still, if you have to, then there are two ways:
1. Run the kubectl edit pod <pod name> command.
This will open the pod specification in an editor (vi editor). Then edit the required properties. When you try to save it, you will be denied. This is because you are attempting to edit a field on the pod that is not editable.
A copy of the file with your changes is saved in a temporary location as shown:
You can then delete the existing pod by running the command:
Then create a new pod with your changes using the temporary file
2. The second option is to extract the pod definition in YAML format to a file using the command
Then make the changes to the exported file using an editor (vi editor). Save the changes
vi my-new-pod.yaml
Then delete the existing pod
Then create a new pod with the edited file
Or simply use one command for combined action:
🎬Stay tuned for another knowledgeable article about Kubernetes and its insides!
🏹Knowledge is power🎯Follow me for the latest updates🌐
Happy learning. 🚀