Kubernetes Flask App Deploy With Microservices(part 2)

Table of contents

No heading

No headings in the article.

In this I have tried to change permission of each and every file to remove it from the repo.

2 Now we will make a new file vim taskmaster.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: taskmaster
  labels:
    app: taskmaster
spec:
  replicas: 1
  selector:
    matchLabels:
      app: taskmaster
  template:
    metadata:
      labels:
        app: taskmaster
    spec:
      containers:
        - name: taskmaster
          image: gauriyadav1504/gauri-micro:latest
          ports:
            - containerPort: 5000
          imagePullPolicy: Always

3 make taskmaster service vim taskmaster-svc.yml

kind: Service
metadata:
  name: taskmaster-svc
spec:
  selector:
    app: taskmaster
  ports:
    - port: 80
      targetPort: 5000
      nodePort: 30007
  type: NodePort

3 make mongo persistent volume file vim mongo-pv.yml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: mongo-pv
spec:
  capacity:
    storage: 256Mi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: /tmp/db

4 make a file to claim persistent volume vim mongo-pv.yml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: mongo-pv
spec:
  capacity:
    storage: 256Mi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: /tmp/db

5 make a mongo file vim mongo.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo
  labels:
      app: mongo
spec:
  selector:
    matchLabels:
      app: mongo
  template:
    metadata:
      labels:
        app: mongo
    spec:
      containers:
        - name: mongo
          image: mongo
          ports:
            - containerPort: 27017
          volumeMounts:
            - name: storage
              mountPath: /data/db
      volumes:
        - name: storage
          persistentVolumeClaim:
            claimName: mongo-pvc

6 make service for mongo file vim mongo-svc.yml

apiVersion: v1
kind: Service
metadata:
  labels:
    app: mongo
  name: mongo
spec:
  ports:
    - port: 27017
      targetPort: 27017
  selector:
    app: mongo

THANKS AND HAPPY LEARNING

HAPPY TO HELP IN DM ON LINKEDIN

LINKEDIN: https://www.linkedin.com/in/gauri-yadav-7aa10a1a6/