Kubernetes परिचय
Frank Heilmann
Platform Architect and Freelance Instructor
Stateful ऐप्स:
रुकने या बंद होने पर, नया replica (Pod) सेव्ड state पढ़कर वहीं से काम जारी रख सकता है
apiVersion, kind, metadata, spec, templatereplicas StatefulSet में Pods की संख्या बताता हैselector पर आगे बात करेंगेapiVersion: apps/v1
kind: StatefulSet
metadata:
name: <deployment name>
labels:
app: <a label for the application>
spec:
replicas: <number of initial replicas>
selector:
matchLabels:
app: <matches the label above>
template:
metadata:
labels:
app: <label to be given to each pod>
spec:
containers:
- name: <container name>
image: <the image to be used>
ports:
- containerPort: <ports for networking>
StatefulSet को Deployments की तरह डिप्लॉय करें:
kubectl apply -f <manifest.yml>StatefulSet का निर्माण Deployment से अलग होता है:pod-0, pod-1, pod-2 आदिStatefulSet के अलग-अलग Pods अपनी पहचान के अनुसार ऐप में अलग भूमिकाएँ निभा सकते हैंreplicas बदलकर फिर से apply करेंkubectl scale statefulsets ... उपयोग करेंpod-0, pod-1, pod-2 के बाद पहले pod-3,
फिर pod-4 जोड़ा जाएगाpod-4, फिर pod-3kubectl इस्तेमाल करेंगेkubectl get pods StatefulSet के सभी pods और उनकी current status देता हैkubectl get services वे सभी services दिखाता है जिन्हें StatefulSet उपयोग कर सकता हैKubernetes परिचय