Config - Secrets Flashcards

1
Q

se

Why would it not be smart to move important configuration details like passwords into a configMap?

A

Because the data is stored in plain text format

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

What are Secrets used for? And why?

A

For storing sensitive information like passwords or keys.

Stored in an encoded format

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

How are the steps for working with secrets?

A
  1. Create Secret
  2. Inject into Pod
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can a secret be created?

A

Imperatively, without yaml file

Declaratively with yaml file

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

How does one create imperatively a secret?

A

‘kubectl create secret generic < secret-name> –from-literal=< key>=< value>’

Key value pairs directly in CI

Or from a file
‘kubectl create secret generic –from-file=< path-tofile>’

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

How does a yaml for a secret look like?

A
apiVersion: v1
kind: Secret
metadata:
  name: app-secret
data:
  DB_HOST: bxWLSD(
	DB_User: ASJDEL(
	DB_password: POMSR%

Important: Data needs to be specified in an encoded format

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

How do you encode text on linux in the cl?

A
echo -n 'mysql'  | base64

echso -n root | base 64

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

How can you view the for a created secret used values?

A

kubectl get descret app-secret -o yaml

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

How do you decode base64 encoded values in Linux?

A

echo -n ‘bXlzcWw=’ | base64 –decode

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

How do you inject Secrets into pods?

A

in Yaml

spec:
...
   envFrom:
	   - secretRef:
	    name: app-secret
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are ways for a secret to be injected into pods?

A
envFrom: 
  - secretRef:
    name: app-secret

env:
- name: DB_Password
  valueFrom: 
	    secretKeyRef:
			  name: app-secret
				key: DB_password
				
---
	
	volumes:
	  - name: app-secret-volume
	    secret: 
			   secretName: app-secret
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is important about secrets?

A
  • secrets are not encrypted, only encoded
  • secrets are not encrypted in etcd by default
  • anyone able to create pods/deployments in the same namespace can access the secrets
  • consider third-party secrets store providers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you install the etcd client in order to encrypt data at rest

A

‘apt-get install etcd-client’

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