Your web application uses Google Kubernetes Engine to manage several workloads. One workload requires a consistent set of hostnames even after pod scaling and relaunches. Which feature of Kubernetes should you use to accomplish this?
StatefulSets is a feature of Kubernetes, which the question asks about. Yes, Persistent volumes are required by StatefulSets (https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/). See the Google documentations for mentioning of hostnames (https://cloud.google.com/kubernetes-engine/docs/concepts/statefulset)... Answer A
A. StatefulSets
To ensure that a workload in Kubernetes has a consistent set of hostnames even after pod scaling and relaunches, you should use StatefulSets. StatefulSets are a type of controller in Kubernetes that is used to manage stateful applications. They provide a number of features that are specifically designed to support stateful applications, including:
Stable, unique network identifiers for each pod in the set
Persistent storage that is automatically attached to pods
Ordered, graceful deployment and scaling of pods
Ordered, graceful deletion and termination of pods
By using StatefulSets, you can ensure that your workload has a consistent set of hostnames even if pods are scaled or relaunched, which can be important for applications that rely on stable network identifiers.
A StatefulSet is the Kubernetes controller used to run the stateful application as containers (Pods) in the Kubernetes cluster. StatefulSets assign a sticky identity—an ordinal number starting from zero—to each Pod instead of assigning random IDs for each replica Pod. A new Pod is created by cloning the previous Pod’s data.
A – StatefulSets
StatefulSets are suitable for deploying Kafka, MySQL, Redis, ZooKeeper, and other applications needing unique, persistent identities and stable hostnames. Read more about StatefulSets. https://cloud.google.com/kubernetes-engine/docs/concepts/statefulset
C – Container Env Variable, are good if you need to init containers with some static content. E.g. Pod passes to containers its HOSTNAME (where containers are running), namespace and user defined vars. So, env vars is a way for Pod to init containers at start up. But, stable hostnames must be preserved at Pod level via StatefulSets.
Defining Env Vars for Container: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
StatefulSets are designed to deploy stateful applications and clustered applications that save data to persistent storage, such as Compute Engine persistent disks. StatefulSets are suitable for deploying Kafka, MySQL, Redis, ZooKeeper, and other applications needing unique, persistent identities and "stable hostnames". Answer is A
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Eroc
Highly Voted 4 years agotartar
3 years, 2 months agoOrangeTiger
1 year, 9 months agokumarp6
2 years, 12 months agonitinz
2 years, 7 months agoomermahgoub
Highly Voted 10 months, 1 week agoTamirm
8 months, 3 weeks agoWangyu60
7 months agokaleemahmad75
Most Recent 9 months, 2 weeks agomegumin
11 months, 3 weeks agoDeepak31
11 months, 3 weeks agoAzureDP900
1 year agozr79
1 year agoDrishaS4
1 year, 2 months agomv2000
1 year, 3 months agoharoldbenites
1 year, 10 months agovincy2202
1 year, 11 months agoMaxNRG
2 years agoArjun1983
2 years agovictory108
2 years, 5 months agoun
2 years, 5 months agoAusias18
2 years, 7 months agoBhupalS
2 years, 10 months agoChulbul_Pandey
2 years, 11 months ago