0% found this document useful (0 votes)
74 views5 pages

Viya 4 Basic Troubleshooting

This document provides instructions for trainees to interact with and troubleshoot their Kubernetes deployments. It includes commands for checking pod statuses, describing pods, viewing logs, updating images, rolling back deployments, accessing containers, and checking node statuses. Trainees are divided into two namespaces: Trainee1 and Trainee2.

Uploaded by

Shubham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views5 pages

Viya 4 Basic Troubleshooting

This document provides instructions for trainees to interact with and troubleshoot their Kubernetes deployments. It includes commands for checking pod statuses, describing pods, viewing logs, updating images, rolling back deployments, accessing containers, and checking node statuses. Trainees are divided into two namespaces: Trainee1 and Trainee2.

Uploaded by

Shubham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Hostname - retail-m1.soltstgroupsgs.sashq-d.openstack.sas.

com

Login with root/Go4thsas

Similar to yesterday you can use trainee1 and tranee2 namspaces respectively

Trainee1 (Mohini Ojha, Archana Patil, Saurabh Tomer, Gorang Khandelwal, Rajesh Kazhankodath,
Narendra Kailasiya, Arun Bhilare, Harrshada Panikkar)

Trainee2 (Amit Kumar Das, Raghunath Sahay, Tanvi P, Pallavi G, Rohit R, Abhishek Tiwari, Sameer Mulay,
Anoop Gadewar, Nishant Palia)

1. How to check the status of all pods in your deployment?

- kubectl -n <namespace> get pods

Typical pod status seen in the deployments in no sequence

a. Pending
b. ContainerCreating
c. Init: x/y
d. Running
e. Init: ErrImagePull
f. Terminating
g. CrashLoopBackOff
h. ImagePullBackOff
- For statuses like a,b,c you need to wait as pod/containers are still coming up
- For Status d – check logs and start testing
- For statuses like e-h need debugging
For complete list of kubelet events

For List of phases in lifecycle of pods.

2. How to describe pods

- kubectl describe pods <podName> -n <namespace>

Check the list of containers and their status

See if the image versions are correct and available

Check the events

3. Check logs

- kubectl -n <namespace> logs <podname>


you can grep for “Tomcat started on port”(for stateless microservices) and check for any
errors
- Following logs(similar to tail)
kubectl -n <namespace> logs <podname> -f
kubectl -n <namespace> logs <podname> --follow

4. Check pod spec

- kubectl get pods -n <namespace> <podName> -o yaml

5. Start/Stop services
To stop a service
- kubectl -n <namespace> delete pod <podName>

OR

- kubectl -n <namespace> scale deployment/<deploymentName> --replicas=0

To stop all microservices

kubectl -n <namespace> scale deployment –all –replicas=0

if you set the replicas=0 then to start the service you need to re-run the same command with
replicas=1

6. How to update an image in a deployment


- Check the current image use kubectl describe pod
- Check rollout history of a deploymet

kubectl rollout history deployment/sas-planning -n trainee1

- Set new image

kubectl set image deployment/<deploymentName> <deploymentName>=<repoURL>

kubectl set image deployment/sas-planning sas-planning=repulpmaster.unx.sas.com/cdp-


release-x64_oci_linux_2-docker-latest/sas-planning:2.0.47-20200610.1591758845952

- Check rollout history of a deploymet

kubectl rollout history deployment/sas-planning -n trainee1

https://repulpmaster.unx.sas.com/v2/
7. How to rollback
- Check the current image use kubectl describe pod
- Check rollout history of a deploymet

kubectl rollout history deployment/sas-planning -n trainee1

- Inspect the revision you want to rollback too

kubectl rollout history deployment/sas-planning -n trainee1 --revision=2

- Rollback

kubectl rollout undo deployment/sas-planning -n trainee1 --to-revision=1

8. Login/run commands on container


- Run command

kubectl -n <namespace> exec -it <podName> <command>

- Login to container

kubectl -n trainee1 exec -it <podName> bash

9. Set password for sasboot

kubectl logs -n <namespace> <saslogon pod name>|grep sasboot

use the token to set the password

10. How to check the list of all nodes and their status in Kubernetes Cluster

- kubectl get nodes

11. How to describe the complete status of a node?

- kubectl describe node <nodeName from kubectl get nodes>

eg: kubectl describe node retail-n1.soltstgroupsgs.sashq-d.openstack.sas.com

You can check

- condition of the node


- capacity of the node
- list of pods running on that node, their utilization
- Node Events
12. Utility to get pull logs and get status

curl -kO https://gitlab.sas.com/enablement/viya-k8s-utils/raw/master/kubectl-get-sas-logs.sh &&


chmod +x kubectl-get-sas-logs.sh

./kubectl-get-sas-logs.sh -n yourspace

https://gitlab.sas.com/enablement/viya-k8s-utils

13. Kubectl refrence


https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-strong-getting-
started-strong-

You might also like