Troubleshooting OpenShift Flashcards

1
Q

Display the list of nodes in a cluster

A

oc get nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Displays the current CPU and memory usage of each node

A

oc adm top nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Displays the resources used by a node

A

oc describe node my-node-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Show the cluster version

A

oc get clusterversion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Show elaborated details about the cluster status

A

oc describe clusterversion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List all cluster operators

A

oc get clusteroperators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

View crio logs on a given node

A

oc adm node-logs -u crio my-node-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

View kubelet logs on a given node

A

oc adm node-logs -u kubelet my-node-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

View all journal logs on a given node

A

oc adm node-logs my-node-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Login into a node and check if kubelete is running

A

oc debug node/my-node-name
chroot /host
systemctl is-active kubelet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Login into a node and show low-level information about all local containers running on the node

A

oc debug node/my-node-name
chroot /host
crictl ps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Display a pod logs

A

oc logs my-pod-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Display a container logs

A

oc logs my-pod-name -c my-container-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Run a given deployment as root

A

oc debug deployment/my-deployment-name –as-root

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Change a pod log level to shows max amount of information

A

oc get pods –loglevel 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Extract your oc login token so you can use it in a curl request

A

oc whoami -t

17
Q

Opens a shell inside a pod to run shell commands

A

oc rsh my-pod-name

18
Q

Copies local files to a location inside a pod

A

oc cp /local/path my-pod-name:/container/path

19
Q

Creates a TCP tunnel from local-port on your workstation to local-port on the pod

A

oc port-forward my-pod-name local-port:remote-port

20
Q

List storage classes of a cluster

A

oc get storageclass

21
Q

Add a volume to an application

A

oc set volumes deployment/example-application –add
–name example-pv-storage
–type pvc
–mount-path /var/lib/example-app
–claim-class nfs-storage
–claim-mode rwo
–claim-size 15Gi
–claim-name example-pv-claim

22
Q

Delete a volume

A

oc delete pvc/example-pvc-storage

23
Q

List cluster nodes using admin cert as opposed to login/password

A

oc –kubeconfig /home/user/auth/kubeconfig get nodes

24
Q

Delete kubeadmin user

A

oc delete secret kubeadmin -n kube-system

25
Q

List all pods inside internal image registry project

A

oc get pod -n openshift-image-registry

26
Q

Tail the logs of the internal image reg operator

A

1) Determine the pod name with: oc get pod -n openshift-image-registry
2) oc logs -f OPERATOR-POD-NAME -n openshift-image-registry

27
Q

Verify that etc is running

A

1) oc debug node/master01
2) chroot /host
3) crictl ps –name etcd

28
Q

Check if an image exist on image registry

A

skopeo inspect docker://registry.redhat.io/rhel8/postgresql-13:1

29
Q

App was created with typo in image reg. How to fix it?

A

1) Find the right image. Use skopeo to inspect
2) oc edit deployment/deployment-name

30
Q

When you create a storage volume, you need to provide a parameter claim-class. How do you obtain values for this parameter?

A

oc get storageclasses

31
Q

Content to add to Oauth.yaml when adding htpasswd identify provider

A
32
Q

Steps to add a htpasswd provider

A

1) Create htpasswd file and populate it
2) Create secret with htpasswd file
3) Assign admin users the cluster-admin role
4) Extract oauth
5) Add identity provider to oauth.yaml
6) Replace oauth.yaml

33
Q

Check what happened to a failed app

A

1) oc get pods
2) oc get status
3) oc get events
4) skopeo inspect docker://registry.redhat.io/rhel8/postgresq-13:1
5) oc edit deployment/psql

34
Q

Different volum access modes

A

rwx: vol can be mounted as read-write by many nodes.
rwo: vol can be mounted as read-write by a single node
rox: vol can be mounted as read-only by many nodes