...see more

Get the deployments

kubectl get deployments

Delete deployments

kubectl delete deployment {deployment_name}

Samples

Sample to expose an endpoint

kubectl expose deployment {app_name} --type=LoadBalancer --port=80 --target-port=80
...see more

Get the resource ID for the existing AKS cluster

Get the resource ID:

SP_ID=$(az aks show --resource-group aksrg --name pdtaks\
    --query servicePrincipalProfile.clientId -o tsv)
az ad sp credential list --id $SP_ID --query "[].endDate" -o tsv

From: AKS ErrImagePull and ImagePullBackOff on AKS after a year

...see more

By default, the kubectl command for Kubernetes uses parameters from the current context to communicate with the cluster.

Display the current context:

$ kubectl config current-context

List all contexts in a kubeconfig file:

$ kubectl config get-contexts

Switch context:

$ kubectl config use-context <context_name>
...see more

A Pod is a group of one or more containers with shared storage, network, and lifecycle and is the basic deployable unit in Kubernetes.

How to get detailed information about Pods using kubectl command.

List Pods in the default Namespace for the current context:

$ kubectl get pods
$ kubectl get pods -o wide


List all Pods from the all Namespace:

$ kubectl get pods --all-namespaces


Get Pods from a particular Namespace:

$ kubectl get pods --namespace <namespace-name>


Get detailed information about a Pod

$ kubectl describe pods <pod-name>
...see more

Commands

az extension add --name connectedk8s
az extension add --name k8s-configuration
az extension update --name connectedk8s
az extension update --name k8s-configuration

Connect to cluster

az connectedk8s connect --name {kubernetes-name} --resource-group {resource-group-name}

Comments