PODS Flashcards

practice k8s pods

1
Q

Docker commands for

  1. starting a container
  2. stop a container
  3. restarting a container
  4. kill a container
  5. remove a stopped container
  6. inspect a container
A
  1. docker start 《img》
  2. docker stop 《containerID》
  3. docker restart 《containerID》
  4. docker kill 《containerID》
  5. docker rm 《containerID》
  6. docker inspect 《containerID》 | less
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Does docker provide a default name when we do not provide one for the container ?

A

Yes .docker provides a default name but it is best practice to provide a name yourself as docker names are weird

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

how to build a docker image ?

A

Two ways

  1. you can imperatively run all the commands necessary to build an image
  2. You can use a Dockerfile which automates the image building
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

give an example of Dockerfile ?

A

FROM centos # build from base image

MAINTAINER kcp # id of person who
maintains the dockerfile
ADD /repo/src/main/ # add repo files to
container
RUN yum install && \
yum update killtcp && \
bash && \
yum clean all #can run multiple
commands using \

CMD “/usr/bin “ [“po’,”c” ]

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

POD

A

POD contains collection of application containers and volumes running in a same execution environment.

All containers inside a POD land on same.machine

Applications running inside a POD
Share
Same IP
host name

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

What is Imperative and Declarative configuration

A

Declarative configuration:
You write down your desired state in a file and submit to k8s and k8s makes sure that desired state meets actual state
Ex. kubectl apply -f pod.yaml
Where pod.yaml is the declarative configuration file

Imperative configuration:
Series of commands run to meet the requirements
Ex. kubectl run nginx –image=nginx

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