kubectl Flashcards

1
Q

get node info

A

kubectl get nodes

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

create my-nginx from nginx with 2 instances and expose 888->80

A

kubectl run my-nginx –image=nginx –replicas=2 –port=80 –hostport=8001

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

get deployments

A

kubectl get deployments

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

details of nginx deployment

A

kubectl describe deployment nginx

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

details of nginx pod

A

kubectl describe pod nginx

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

expose the container port 80 on the host 8000 binding to the external-ip of the host.

A

kubectl expose deployment http –external-ip=”172.17.0.7” –port=8000 –target-port=80

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

get services

A

kubectl get svc

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

details of a service http

A

kubectl describe svc http

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

scale my-nginx to 3 replicas

A

kubectl scale –replicas=3 deployment my-nginx

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

deploy spec..yaml to a new cluster

A

kubectl create -f spec.yaml

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

update spec.yaml to the existing cluster

A

kubectl apply -f spec.yaml

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

create a replica set

A

kubectl create -f replicase-definition.yaml

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

list replica sets

A

kubectl get replicates

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

delete replica set with all underlying pods

A

kubectl delete replicates my-app-replicaset

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

update the replicaset replicaset-definition.yaml

A

kubectl replace -f replicaset-definition.yaml

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

scale the replicaset replicaset-definition.yaml

A

kubectl scale –replicas=6 -f replicase-definition.yaml

17
Q

create a deployment from my-deployment.yaml

A

kubectl create -f my-deployment.yaml

18
Q

list deployments

A

kubectl get deployments

19
Q

list deployments, replicasets, pods

A

kubectl get all

20
Q

rollout status of my-deployment

A

kubectl rollout status deployment/my-deployment

21
Q

revisions and history of my-deployment

A

kubectl rollout history deployment/my-deployment

22
Q

see the deployments detail

A

kubectl describe deployments

23
Q

undo my-deployment - go back to previous version

A

kubectl rollout undo deployment/my-deployment

24
Q

create a deployment for my-nginx pod with nginx image

A

kubectl run my-nginx –image=nginx