[useless] Tips Flashcards

1
Q

Set an alias for ‘kubectl’

A

alias k=kubectl

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

Generate a declarative configuration file for a pod using an imperative command

A

kubectl run p1 –image=nginx –restart=Never –dry-run=client -o yaml > p1.yaml

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

Generate a declarative configuration file for a deployment using an imperative command

A

k run d1 –image=nginx –dry-run -o yaml > d1.yaml

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

Generate a declarative configuration file for a job using an imperative command

A

kubectl run j1 –image=nginx –restart=OnFailure –dry-run=client -o yaml > j1.yaml

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

Generate a declarative configuration file for a cronjob using an imperative command

A

kubectl run cj1 –image=nginx –restart=OnFailure –schedule=”*/1 * * * *” –dry-run=client -o yaml > cj1.yaml

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

Shortcut (alias) for configmaps?

A

cm

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

Shortcut (alias) for namespaces?

A

ns

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

Shortcut (alias) for nodes?

A

nodes

(trick question, there is no shortcut)

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

Shortcut (alias) for persistent volume claims?

A

pvc

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

Shortcut (alias) for persistent volumes?

A

pv

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

Shortcut (alias) for pods?

A

po

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

Shortcut (alias) for statefulsets?

A

sts

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

Shortcut (alias) for resource quotas?

A

quota

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

Shortcut (alias) for service accounts?

A

sa

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

Shortcut (alias) for services?

A

svc

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

Shortcut (alias) for deployments?

A

deploy

17
Q

Shortcut (alias) for replica sets?

A

rs

18
Q

Shortcut (alias) for cronjobs?

A

cj

19
Q

Shortcut (alias) for jobs?

A

jobs
(trick question, there is no alias!)

20
Q

Shortcut (alias) for ingresses?

A

ing

21
Q

Shortcut (alias) for storage classes?

A

sc

22
Q

Shortcut (alias) for network policies?

A

netpol

23
Q

bash alias for setting namespace for current context

A

alias kn=’kubectl config set-context –current –namespace ‘

24
Q

create a vim configuration for two spaces when tab key is pressed

A

vim ~/.vimrc
set tabstop=2
set expandtab

25
Q

Provide a pod within the cluster from which to shell into to curl other pods

A

kubectl run -it --rm curl --image=radial/busyboxplus:curl --restart=Never

26
Q

What is the shortcut imperative command for getting all pods in all namespaces?

A

k get po -A

27
Q

Imperative command to get the logs of a previous instance of a pod?

(e.g. for a pod named po1)

A

kubectl logs po1 -p