List of kubernetes commands which will help in kubernetes management.

Divyanshi SinghDivyanshi Singh
2 min read

Service Management
Create a service: kubectl create service <service-type> <service-name> –tcp=<port>
List all services: kubectl get services Describe a specific service: kubectl describe service <service-name>
Expose a deployment as a service: kubectl expose deployment <deployment-name> –port=<port>
Delete a service: kubectl delete service <service-name>
Get information about a service: kubectl get endpoints <service-name>

Replica Sets Management
Create a ReplicaSet: kubectl create -f <replicaset-definition.yaml>
List all ReplicaSets: kubectl get replicasets or rs
Describe a specific ReplicaSet: kubectl describe replicaset <replicaset-name>
Scale a ReplicaSet: kubectl scale replicaset <replicaset-name> –replicas=<replica-count>

Config Maps and Secrets
Create a config map from a file: kubectl create configmap <config-map-name> –from-file=<path-to-file>:
Create a secret: kubectl create secret <secret-type> <secret-name> –from-literal=<key>=<value>
List all config maps: kubectl get configmaps
List all secrets.: kubectl get secrets
Describe a specific config map: kubectl describe configmap <config-map-name>
Describe a specific secret: kubectl describe secret <secret-name>
Delete a specific secret: kubectl delete secret <secret_name>
Delete a specific config map: kubectl delete configmap <config-map-name>

Networking
Port forward to a pod: kubectl port-forward <pod-name> <local-port>:<pod-port>
Expose a deployment as a NodePort service: kubectl expose deployment <deployment-name> –type=NodePort –port=<port>
Create an Ingress resource: kubectl create ingress <ingress-name> –rule=<host>/<path>=<service-name> –<service-port>
Get information about an Ingress: kubectl describe ingress <ingress-name>
Retrieves the most value from the first rule of the specified Ingress resource: kubectl get ingress <ingress-name> -o jsonpath='{.spec.rules[0].host}’

Sums up day 6 with kubernetes series.

0
Subscribe to my newsletter

Read articles from Divyanshi Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Divyanshi Singh
Divyanshi Singh