Security - KubeConfig Flashcards

1
Q

How can you call a KubeConfig-File with kubectl?

A

kubectl get pods –kubeconfig config

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

What are contents of KubeConfig?

A
-- server my-kube-playground:6443
--client-key admin.key
--client-certificate admin.crt
--certificate-authority ca.crt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Where does the kubectl command look by default for a kubeconfig file?

A

$HOME/.kube/config

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

What is the structure of a KubeConfig file?

A
  1. Clusters (various clusters, you need access to)
  2. Contexts (define which user account will be accessed with which cluster, Dev@Google)
  3. Users (user accounts with which you have access to these clusters)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does a KubeConfig file look?

A
apiVersion: v1
kind: Config
current-context: dev-user@google
clusters:
  - name: my-kube-playground
    cluster:
		 certificate-authority: ca.crt
			server; https://my-kube-playground:6443

contexts:
  name: my-kube-admin@my-kube-playground
	context: 
	  cluster: my-kube-playground
		user: my-kube-admin

users:
  - name: my-kube-admin
    user:
		  client-certificate: admin.crt
			client-key: admin.key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the ‘current-context’ in a KubeConfig used for?

A
  • specifies the default context that should be user?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can we view the current used KubeConfig file?

A

kubectl config view

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

How do you update your current context?

A

kubectl config user-context prod-user@production

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

Can you configure a context to switch to a particular namespace?

A

Yes
Contexts section in the KubeConfig file can take a field
context.namespace

When you switch to that context, youre automatically in that namespace

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

With what command can you see config files under /.kube/

A

with ‘ls -a’

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

How can you view a environment variable on linux?

A

echo $VARIABLE

like
echo $HOME

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

In linux how can you copy a file from place a to b?

A

cp my-kube-config ~/.kube/config

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

In linux how can you rename a file?

A

mv oldfilename newfilename

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