Recap Core Concepts Flashcards

1
Q

What are parts of the Open Container Initiative?

A
  • imagespec: specifications on how an image should be build
  • runtimespec: how any container runtime should be build
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the tool ‘ctr’?

A
  • CLI
  • comes with containerD
  • made for debugging containerD
  • only supports limited set of features
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is ‘nerdctl’?

A
  • CLI
  • provides a Docker-like CLI for containerD
  • very similiar to Docker commands
  • supports most of the options docker offers
  • supports: Lazy Pulling, encrypted container images, …
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is ‘crictl’?

A
  • CLI for CRI compatible container runtimes
  • command line utility used to interact with the CRI compatible runtime
  • installed separately
  • comes from Kubernetes perspective
  • works across different runtimes
  • used to inspect and debug container runtimes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name a few ‘crictl’ commands

A
  • crictl
  • crictl pull busybox : pulls an image
  • crictl images : list existing images
  • crictl ps -a : list containers
  • crictl exec -i -t 3e024dd50a72.. ls : run a command inside a container, with same options (-i for staying open, even when not attached, -t for allocating a pseudo -tty)
  • crictl logs < container-id>
  • crictl pods
  • crictl inspect …
  • crictl attach …
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How are endpoints handled with crictl?

A
  • users are encouraged to manually manage endpoints for interaction
  • ‘crictl –runtime-endpoint’
  • ‘crictl –image-endpoint
  • or by setting the environment variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In a ‘kubectl delete’ command, how do you terminate multiple pods?

A
  • by chaining htem together with space

‘kubectl delete pod new-pod-1 new-pod-2 new-pod-3’

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

Name a few options for the Output format flag for commands

A

‘kubectl [command] [TYPE] [NAME] -o < output-format>’

-o json -> JSON formatted API object
-o name -> print only resource name
-o wide -> plain text with additional information
-o yaml -> yaml formatted api object

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

What is the default namespace and when is it created?

A

‘Default’-namespace
- created when the cluster is the first time set up

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

What is the namespace called, that is used for internal purposes, such as thos required by networking solution, DNS service etc

A

kube-system
- created at cluster-startup

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

What is the namespace called with resources that should be made available to all users?

A

kube-public

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

Which namespaces are created with cluster-startup?

A

kube-system
default
kube-public

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

What can be set for namespaces?

A
  • own set of policies, who can do what
  • quota of resources, that is allowed to use
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How would it be possible to connect a container from one namespace to a container in a different namespace?

A
  • by appending the namespace to the application name
    ‘db-service’
    ->
    ‘db-service.dev.svc.cluster.local’
    -> possible, because when service is created, a DNS entry is created automatically in this format

‘cluster.local’ is the default domain name of kubernetes cluster
‘svc’ is subdomain of service
‘dev’ is the namespace
‘db-service’ is the service name

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

How is a dns-entry for a service name structured?

A

SERVICE-NAME.NAMESPACE.svc.cluster.local

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

How can you specify the namespace in a kubectl command?

A

‘kubectl get pods –namespace=kube-system’
or ‘-n’ in short for namespace

15
Q

How does a yaml file look with the namespace definition included?

A
apiVersion:
kind:
metadata:
    name: xxx
    namespace: dev
    labels:
	  
		
spec:
16
Q

How do you create a new namespace?

A

Like any other object, yaml

apiVersion: v1
kind: Namespace
metadata:
  name: dev

OR
‘kubectl create namespace name’

17
Q

How do we switch to a different namespace?

A

‘kubectl config set-context $(kubectl config current-context) –namespace=dev’

(kubectl config current-context) -> identifies the current context and then sets it

18
Q

How can we see the pods from all namespaces?

A

‘kubectl get pods –all-namespaces’

19
Q

How do we limit the resources used in a namespace?

A
  • using a resource quota
  • yaml-definition file
apiVersion: v1
kind: ResourceQuota
metadata: 
  name: compute-quota
	namespace: dev
spec:
  hard:
	  pods: "10"
		requests.cpu: "4"
		requests.memory: 5Gi
		limits.cpu: "10"
		limits.memory: 10Gi
20
Q

What does the addition ‘-A’ do to a command?

A
  • covers all the namespaces

kubectl get pods -A
equals
kubectl get pods –all-namespaces

21
Q

What is command to create a deployment with a certain image and number of replicas?

A

kubectl create deployment nginx-deployment –image=nginx –replicas=4

22
Q

How can you generate from the cl a yaml file for a deployment

A

kubectl create deployment nginx-deployment –image=nginx –replicas=4 -o yaml > deployment-definition.yaml

23
Q

How can you expose a pod with a service via cl?

A

kubectl expose pod nginx –port=6379 –name=nginx-service –type=NodePort

The NodePort then needs to be specified after generating the yaml or service

24
Q

What is important about the order of creating services and pods?

A
  • when creating pods, services that should be connected should be created beforehand
  • when a pod is created, the environment variables are being set, including the service only if it was created before the pod
25
Q

How do you create a pod with certain labels?

A

kubectl run nginx –image=nginx –labels=”tier:frontend, env=prod”

26
Q

How can you specify the container port for a pod you want to deploy via the cl?

A

kubectl run custom-nginx –image=nginx –port=8080

27
Q

What does ‘kubectl config view | grep namespace’ do?

A

Shows the namespace entry in the current context

28
Q

How can we expose a service and create a pod in one command?

A

kubectl run redis –image=redis –port=80 –expose=true