Skip to main content

General Kubernetes Commands Documentation

Creating and Managing Pods

Create an NGINX Pod

Generate POD Manifest YAML file (-o yaml). Don’t create it (—dry-run)

Creating and Managing Deployments

Create a Deployment

Generate Deployment YAML file (-o yaml). Don’t create it (—dry-run)

Generate Deployment YAML file (-o yaml). Don’t create it (—dry-run) and save it to a file.

Create a Deployment from a YAML file

Create a Deployment with 4 replicas directly using command

Scale a Deployment using the kubectl scale command

Creating and Managing Services

Create a Service named redis-service of type ClusterIP to expose pod redis on port 6379

Or

Create a Service named nginx of type NodePort to expose pod nginx’s port 80 on port 30080 on the nodes

Or

Practise Test Commands

Create a Redis Pod with specific labels and no restart

Expose a Deployment named redis-deployment as a ClusterIP service

Expose a Pod named custom-nginx as a NodePort service

Create a new namespace

Edit a Deployment in a specific namespace

Expose a Pod named httpd as a ClusterIP service

Replace a resource defined in a YAML file

Continuously watch Pod status updates

Describe a Node and grep for Taints

Add a Taint to a Node

Remove a Taint from a Node

Add a label to a Node

Metrics Server Commands

Enable the Metrics Server add-on in Minikube

Clone the Metrics Server repository and deploy

Check Node resource usage

Check Pod resource usage

Logs and Debugging

View logs of a specific Pod

View logs of a specific container within a Pod


By using these commands, you can effectively manage your Kubernetes resources, from creating and scaling deployments to exposing services and monitoring resource usage. Each command provides a way to interact with the Kubernetes API, enabling you to automate and streamline your workflows.