Using kubectl to List Namespaces

$ kubectl get namespaces

Fetching a List of Pods in a Specified Namespace in Kubernetes

$ kubectl -n/–namespace ${namespace} get pods

Retrieving Logs for a Specific Pod in Kubernetes

$ kubectl -n/–namespace ${namespace} logs ${pod}

Getting a List of Deployments in Kubernetes

$ kubectl -n/–namespace ${namespace} get deployment

Retrieving Specific Deployment Details

$ kubectl -n/–namespace ${namespace} describe deployment ${deployment}

Restarting a Specific Pod

$ kubectl -n/–namespace ${namespace} rollout restart deployment/${pod}

Forcibly Deleting a Pod by Name

$ kubectl -n/–namespace ${namespace} delete pod ${pod} –grace-period=0 –force

Retrieving a List of Services

$ kubectl -n/–namespace ${namespace} get Services

Getting a List of PVCs

$ kubectl -n/–namespace ${namespace} get pvc

Retrieving Details of a Specific PVC

$ kubectl -n/–namespace ${namespace} describe pvc ${pvc}

Getting a List of CronJobs

$ kubectl -n/–namespace ${namespace} get cronjobs

Deleting a Specific CronJob

$ kubectl -n/–namespace ${namespace} delete cronjob ${cronjob}

Leave a Reply

Your email address will not be published. Required fields are marked *