Optional - Storage Classes, StatefulSets Flashcards

1
Q

What is Static Provisioning?

A
  • when creating PVs/PVCs etc you define what volume (azure, aws) should be used
  • before it can be used, it first must be manually provisioned, using the same name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are Storage Classes used for?

A
  • used for dynamic provisioning underlying volume storage
  • allows to define provisioners (like google storage) to dynamically provision storage on google cloud and attach that to pods when a claim is made
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you define a Storage Class?

A

sc-definition.yaml
~~~
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: google-storage
provisioner: kubernetes.io/gce-pd
~~~

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

How are Storage Class yamls used?

A
  • instead of PV.yaml
  • in PVC.yaml:
    ~~~
    spec:
    accessModes:
    - ReadWriteOnce
    storageClassName: google-storage
    resources:
    requests:
    storage: 500 Mi
    ~~~
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does dynamic provisioning work?

A
  • when a new claim is created
  • it uses the defined provisioner to provision a new disk with the required size
  • then creates a persistent volume and then binds the pvc to that volume
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why do we need Stateful Sets? Why are deployments not enough?

A
  • are similiar to deployments sets
  • create pods based on a template
  • scale up/down
  • perform updates and rollbacks

BUT:
- pods are created in a sequential order
- first pod must be running, before the next one is deployed
- assign unique ordinal index to each pod
- maintain a sticky identity for pods
- name schema: set-name + pod nr (1-x)
- pods perform a clone from the previous nr, (2 from 1, etc)

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

How do you define a Stateful Set?

A

Like a Deployment but kind=StatefulSet und spec.serviceName (for the name of a headless service)

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

Take a set of database pods, why can you not use a regular service to read and write?

A
  • because the default Loadbalancer would split the writes and reads among all db-instances
  • but we want writes to happen only on the db-master instance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a headless Service? What does it do?

A
  • created like a regular service
  • but has no IP of its own
  • does not perform any load balancing
  • Creates DNS entries for each pod using the pod-name and a sub-domain

podname.headless-servicename.namespace.svc.cluster-domain.example

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

How do we create a headless service?

A
apiVersion: v1
kind: Service
metadata: 
  name: mysql-h
spec:
  ports:
	 - port: 3306
	selector:
	  app: mysql
	clusterIP: None

clusterIP: None is new

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

How do you point from a headless service to a pod?

A
  • Pod definition yaml spec.subdomain needs to be the same as the name of the service
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you create a DNS record for a service to point to specific pods?

A

in Pod-yaml, beside spec.subdomain, add:
- hostname:

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

What are Security Primitives?

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