kubectl is a command-line tool that lets you communicate with and manage Kubernetes clusters. It helps you deploy applications, inspect and manage cluster resources, and view logs.
You use the Azure CLI command az aks get-credentials --resource-group <group> --name <cluster-name> to download and merge the cluster's access credentials into your local kubeconfig file. Then kubectl uses this config to connect.
kubectl get pods do?This command lists all the pods running in the current namespace of your Kubernetes cluster. Pods are the smallest deployable units that hold your containers.
kubectl apply -f <file>.This command applies the configuration in the specified file to the cluster. It creates or updates resources like deployments or services based on the file's content.
Use kubectl logs <pod-name> to see the logs of a specific pod. This helps you understand what is happening inside the containers.
az aks get-credentials downloads and merges the cluster credentials into your kubeconfig file for kubectl to use.
kubectl get nodes show?This command lists all the worker machines (nodes) in your Kubernetes cluster.
kubectl apply -f updates or creates resources defined in the file.
kubectl describe pod shows detailed information including events and status.
By default, kubectl commands work in the default namespace unless you specify another.