Thursday, August 31, 2023

{KUBE-2} KUBERNETES PODS REPLICASETS & DEPLOYMENTS


Simple POD apply:

yml file:
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - image: nginx
    name: nginx
kubectl apply -f 1-nginx-pods.yaml

 

Replicaset Apply:
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  labels:
    run: nginx
  name: nginx-replicaset
spec:
  replicas: 2
  selector:
    matchLabels:
      run: nginx
  template:
    metadata:
      labels:
        run: nginx
    spec:
      containers:
      - image: nginx
        name: nginx
kubectl apply -f 1-nginx-replicaset.yaml

 

Scale application:
kubectl scale replicaset.apps/nginx-replicaset --replicas=3



Deployments:
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: nginx
  name: nginx-deploy
spec:
  replicas: 2
  selector:
    matchLabels:
      run: nginx
  template:
    metadata:
      labels:
        run: nginx
    spec:
      containers:
      - image: nginx
        name: nginx
kubectl apply -f 1-nginx-deployment.yaml

END OF NOTES.

No comments:

Post a Comment