How to Deploy and Scale a PHP Project Using Kubernetes



Kubernetes YAML (deployment.yaml) File

apiVersion: v1
kind: Service
metadata:
  name: onlinecompiler-service
spec:
  selector:
    app: onlinecompiler
  ports:
  - protocol: "TCP"
    port: 80
    targetPort: 80
  type: NodePort

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: onlinecompiler
spec:
  selector:
    matchLabels:
      app: onlinecompiler
  replicas: 1
  template:
    metadata:
      labels:
        app: onlinecompiler
    spec:
      containers:
      - name: onlinecompiler
        image: shawon10/online-compiler
        imagePullPolicy: Always
        ports:
        - containerPort: 80
 
Kubernetes Deployment Command
kubectl apply -f deployment.yaml
 
Show Pods
kubectl get pods

Show IP and Port of pods
kubect get svc
 
Show Deployments
kubectl get deployments
 
Scale Pods
kubectl scale deployments  deployment_name --replicas=3


  

Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment