Configuration & Security Flashcards

(17 cards)

1
Q

What is a ConfigMap?

A

An API object used to store non-confidential data in key-value pairs for pods to consume.

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

What is a Secret?

A

An object used to store sensitive data (passwords / tokens) encoded in base64.

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

How do you inject a ConfigMap into a Pod as an environment variable?

A

Use the ‘envFrom’ or ‘valueFrom’ field in the Pod spec.

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

What is a ServiceAccount?

A

An identity used by processes in a Pod to communicate with the Kubernetes API.

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

What is a SecurityContext?

A

A set of constraints that define the privilege and access control settings for a Pod/Container.

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

How do you run a container as a specific User ID?

A

Set ‘runAsUser: <ID>' inside the securityContext.</ID>

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

What are Resource Quotas?

A

Constraints that limit the total amount of CPU/Memory a Namespace can consume.

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

How do you prevent a ConfigMap from being updated once created to reduce Kubelet load?

A

Set ‘immutable: true’ in the ConfigMap metadata.

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

What is the ‘subPath’ field used for when mounting a ConfigMap?

A

To mount a single file from a ConfigMap into a directory without overwriting existing files in that directory.

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

How do you ensure a container cannot gain more privileges than its parent process?

A

Set ‘allowPrivilegeEscalation: false’ in the securityContext.

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

What happens to a Pod if a Secret it references as an environment variable is missing?

A

The Pod will remain in ‘CreateContainerConfigError’ and will not start.

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

How do you set the default file permissions (e.g. 0400) for all files in a mounted Secret volume?

A

Use ‘defaultMode: 0400’ under the ‘volumes’ -> ‘secret’ section.

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

How do you force a Pod to run as a non-root user even if the Docker image defaults to root?

A

Set ‘runAsNonRoot: true’ in the Pod or Container securityContext.

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

What are the three main parts of a Kubeconfig file?

A

Clusters, Contexts, and Users.

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

Where are the client certificates usually stored in a Kubeconfig for a user?

A

Under the ‘user’ section, either as file paths or ‘client-certificate-data’ (base64).

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

How do you view the ‘Common Name’ (CN) of a K8s certificate file using openssl?

A

openssl x509 -in <file> -text -noout | grep Subject</file>

17
Q

What is the ‘system:masters’ group in Kubernetes?

A

A hard-coded RBAC group that bypasses all permission checks (full cluster-admin).