Kubernetes परिचय
Frank Heilmann
Platform Architect and Freelance Instructor
kubectl: Kubernetes ऑब्जेक्ट्स से इंटरैक्ट करने का मुख्य कमांडpod, service, आदि$$
सामान्य उपयोग पैटर्न:
kubectl create -f <Manifest.yml>: नए ऑब्जेक्ट बनाते हैं,
-f मतलब "filename"kubectl apply -f <Manifest.yml>: नए ऑब्जेक्ट बनाते हैं और
ऑब्जेक्ट्स की state बदलते हैंkubectl get <object>:
Kubernetes पर डिप्लॉय ऑब्जेक्ट्स का ओवरव्यूkubectl describe <object>: किसी ऑब्जेक्ट की विस्तृत जानकारी$$
कमांड लाइन विकल्प --help से विस्तृत मदद उपलब्ध
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 5
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.25.4
ports:
- containerPort: 80
Stateless ऐप्स:
बाधित होने पर, stateless ऐप की नई replica बनती है और चलना शुरू करती है।
apiVersion और kindmetadata और specspec में replicas की संख्या, selector, और template परिभाषित होते हैंselector पर आगे और जानकारीtemplate Deployment में pods बनाने का विवरण बताता हैapiVersion: apps/v1
kind: Deployment
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>
kubectl apply -f <manifest.yml> से pods बनाएँ और
बदलाव अप्लाई करें।Kubernetes परिचय