Any alternate command of Kubectl describe pods <podname>

3/10/2019

I am new to Dev Ops. I am setting up a CD pipeline in the VSTS. I have used Deploy to Kubernetes task to deploy the application, which is working fine.

After Deploy to Kubernetes task, I have added one more Deploy to Kubernetes task and I want to execute below command

kubectl describe pods <podname>

Above command describe about the pod.

I can see there is no such command available in the Deploy to Kubernetes task (in VSTS pipeline) for describe.

Only available commands are get, apply, set, exec, login, logout, create, delete, expose, run and top.

By executing above commands, I want to make sure is each pods is running.

How can I execute the describe command in the VSTS CD pipeline?

Alternative option is, any other command, which will return same output as describe pods <podname> command.

-- HowsTheJosh
azure
azure-aks
azure-devops
azure-pipelines
kubernetes

1 Answer

3/11/2019

you can use labels to find the pod you are interested in:

$ kg po --show-labels
NAME                                 READY     STATUS    RESTARTS   AGE       LABELS
frontend-76dc7bfc6d-7zcb8            1/1       Running   0          9h        app=Frontend,branch=develop,pod-template-hash=76dc7bfc6d
identityserverapp-f9684fc77-z9wtb    1/1       Running   0          9h        app=IdentityServerApp,branch=develop,pod-template-hash=f9684fc77

$ kg po --selector=app=Frontend
NAME                        READY     STATUS    RESTARTS   AGE
frontend-76dc7bfc6d-7zcb8   1/1       Running   0          9h

ps. kg = alias for kubectl get

-- 4c74356b41
Source: StackOverflow