Saturday 8 August 2020

Kuberentes: Troubleshooting the application

 Using kubectl describe command

Using ‘kubectl describe’ command, you can get detailed information about pods, deployments.

Let’s create a deployment.

kubectl create deployment hello-node --image=jboss/wildfly

$kubectl create deployment hello-node --image=jboss/wildfly
deployment.apps/hello-node created

Get the deployments.

$kubectl get deployments
NAME         READY   UP-TO-DATE   AVAILABLE   AGE
hello-node   1/1     1            1           22s

Use below command to describe the deployment hello-node.

kubectl describe deployment/hello-node

 

Get the pods.

$kubectl get pods
NAME                         READY   STATUS    RESTARTS   AGE
hello-node-59fddbb58-lnh7v   1/1     Running   0          81s

Describe the pod

kubectl describe pod/hello-node-59fddbb58-lnh7v

 

Checking the logs

‘kubectl logs podName’ command is used to get the logs.

 

kubectl logs hello-node-59fddbb58-lnh7v

 

Login to a specific pod

Below command is used to login to the pod.

kubectl exec -it hello-node-59fddbb58-lnh7v /bin/bash

$kubectl exec -it hello-node-59fddbb58-lnh7v /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] -- [COMMAND] instead.
[jboss@hello-node-59fddbb58-lnh7v ~]$

Once you login to the pod, you can check the log files, execute shell commands.

[jboss@hello-node-59fddbb58-lnh7v ~]$ ps -eaf 
UID        PID  PPID  C STIME TTY          TIME CMD
jboss        1     0  0 08:35 ?        00:00:00 /bin/sh /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0
jboss       81     1  3 08:35 ?        00:00:09 /usr/lib/jvm/java/bin/java -D[Standalone] -server -Xms64m -Xmx5
jboss      195     0  0 08:38 pts/0    00:00:00 /bin/bash
jboss      214   195  0 08:39 pts/0    00:00:00 ps -eaf





Previous                                                    Next                                                    Home

No comments:

Post a Comment