WHAT IS KUBERNETES PT2 Flashcards

STORAGE, LIMITATIONS, NAMESPACES, CONFIG MAPS, SECRETS

1
Q

What was the primary storage mechanism in Kubernetes initially, and what were its limitations?

A

Volumes were the initial storage mechanism, directly accessible by pods. However, they were ephemeral, tied to a pod’s lifecycle, and local to a pod, limiting their usefulness for persistent storage needs.

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

What is a persistent volume in Kubernetes, and how does it differ from a regular volume?

A

A persistent volume is pod-independent storage defined at the cluster level by an administrator. Unlike regular volumes, it exists independently of any individual pod and can be provisioned and managed separately.

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

How does a pod request storage from a persistent volume in Kubernetes?

A

A pod uses a Persistent Volume Claim (PVC) to request storage from the available persistent volumes in the cluster. The PVC decouples the pod from the underlying storage, providing flexibility.

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

From which sources can Kubernetes pods mount storage?

A

Pods can mount storage from local storage, remote network storage, or cloud storage services.

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

How does Kubernetes manage storage backends, and who typically handles the storage backend?

A

Kubernetes provides the framework for managing storage, but the actual storage backend is handled by various solutions, such as cloud providers or on-premise storage systems.

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

Why is database storage often handled outside of Kubernetes?

A

Many organizations prefer using managed database services provided by cloud providers or maintaining their databases on dedicated infrastructure for reliability and performance reasons.

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

What is the default type of storage in Kubernetes, and how can it be configured for stateful applications?

A

The default storage in Kubernetes is ephemeral, and useful for temporary data. It can be configured as persistent for stateful applications that require data to be preserved.

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

While Kubernetes offers a powerful platform for container orchestration, it does have some limitations.

What are those limitations?

A
  • Native code building and deployment: Kubernetes does not natively support code building or deployment processes.
  • Node configuration management: Offers limited options for granular node configuration management compared to dedicated enterprise solutions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the primary purpose of namespaces in Kubernetes?

A

Namespaces divide cluster resources into logical partitions, providing organization and isolation of resources, particularly in large clusters with multiple teams or users.

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

How do namespaces help prevent resource name conflicts in Kubernetes?

A

Namespaces create boundaries for resource names, ensuring names are unique within a namespace but can be reused across different namespaces.

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

Are all resources in Kubernetes tied to namespaces? Give examples

A

No, some resources, such as Persistent Volumes, nodes, and StorageClasses, are cluster-wide and not tied to a specific namespace.

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

Can namespaces in Kubernetes be nested or shared by multiple resources?

A

No, namespaces cannot be nested, and a given resource can only belong to one namespace at a time.

Kubernetes clusters have a default namespace.

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

can you give examples of some commands for interacting with namespaces:

A

○View all namespaces: kubectl get ns (where “ns” is shorthand for “namespace”).

○Get pods within a specific namespace: kubectl get pod -n kube-system (the “-n” flag is used to specify the namespace).

○Create a new namespace: kubectl create ns <namespace_name>.</namespace_name>

○Filter namespaces with specific words: kubectl get ns | grep app1.

○Deploy a pod in a specific namespace: kubectl apply -f nginx.yaml -n app1namespace.

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

What is a ConfigMap in Kubernetes, and

What is the primary benefit of using ConfigMaps in Kubernetes?

A

A ConfigMap is a mechanism for storing non-confidential configuration data in key-value pairs.

ConfigMaps separate configuration data from application code, making it easier to manage and update settings without modifying the application itself.

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

What types of settings can be stored in a ConfigMap?

A

A ConfigMap can store settings such as database URLs, user-preferred languages, and port numbers.

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

What is the size limit for a ConfigMap in Kubernetes?

A

The size limit for a ConfigMap is 1 MiB.

17
Q

What are the three main ways to pass ConfigMap data into pods?

A

Command-line arguments: Suitable for testing but not ideal for production.

Environment variables: Convenient but doesn’t support automatic updates.

Config files on a storage volume: Supports automatic updates, making it the most robust approach.

18
Q

Can a pod access a ConfigMap in a different namespace?

A

No, a pod can only access a ConfigMap if they are in the same namespace.

19
Q

Give an example of a config map with an environmental variable

A

This example defines an environment variable named PORT that will be populated with the value of the port key from the app1-config ConfigMap

20
Q

Give an example of a config map mounted as a volume

A

you can mount the ConfigMap as a volume in your pod

In this example, the ConfigMap myconfigmap is mounted as a read-only volume at the path /etc/configmap1 within the pod. This allows scripts or code within the pod to access the ConfigMap data by reading files from that directory.

21
Q

What is the primary purpose of secrets in Kubernetes?

A

Secrets store sensitive information, like passwords, certificates, and SSH keys, separately from application code to enhance security.

This enhances security by preventing sensitive data from being directly embedded in container images or configuration files.

22
Q

How are secrets stored in Kubernetes, and what level of protection does this provide?

A

Secrets are Base64 encoded and stored in the etcd cluster store, providing basic protection against casual inspection but not encryption.

23
Q

What are the different types of secrets in Kubernetes?

A

TLS secrets: Store TLS certificates for authentication and secure connections.

Opaque secrets: A generic type for storing any sensitive data.

Dockercfg secrets: Store Docker-related information, such as private registry credentials.

SSH secrets: Store private keys for SSH authentication.

24
Q

How can secrets be accessed by containers in Kubernetes?

A

As command-line arguments.

As files on mounted volumes.

As environment variables extracted from the cluster’s secret store.

25
Q

What is the purpose of making secrets immutable in Kubernetes?

A

Making secrets immutable protects them from accidental modification, adding an extra layer of security.