Namespaces Flashcards

1
Q

What is a namespace

A

A mechanism for isolating groups of resources within a single cluster

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

What are the four automatically generated namespaces

A
  1. default
  2. kube-system
  3. kube-public
  4. kube-node-lease
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the kube-system namespace for

A

Made for objects created by the Kubernetes system

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

What does the kube-public namespace for

A
  • reserved for cluster usage in case some resources need to be public
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the kube-node-lease namespace for

A
  • holds Lease objects associated with each node
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a K8s Lease

A
  • leases allow the kubelet to send heartbeats so that the control plane can detect node failure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain an example of different namespaces

A
  • The same cluster has different namespaces for dev and prod
  • Namespaces have their own policy
  • Namespaces have a quota of the nodes in a cluster
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do resources within the same namespace refer to each other?

A

By their resource name (e.g. web-prod, db-service)

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

How do resources communicate with other resources in another namespace

A

Using DNS.
service-name.namespace.svc.cluster.local

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

How to list all pods in a namespace

A

$ k get pods –all-namespaces

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

How to list pods in a specific namespace

A

$ k get pods –n=<namespace></namespace>

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

How to create pod in a namespace

A

k create -f pod-definition.yaml –ns=dev

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

How to create a namespace

A

$ k create namespace <name></name>

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

How to get cluster IP, external IP, or ports about services in a namespace

A

k get svc -n=<namespace></namespace>

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