serving the solutions day and night

Pages

Wednesday, August 19, 2020

Deploy ASP.NET Core Application different image verison in Kubernetes

Deploying the pods (individually or with a replication controller), using the same labels, except for the version, for which you use the value v2. 

Modified the code (frontendmvc).

Build the image, re name the image tag version 2 & publish the image to Docker Hub

docker build -t frontendmvc .
docker tag frontendmvc makader/myapp:frontendmvc-v2
docker push makader/myapp:frontendmvc-v2

New version deployment (forntendmvc_rcv2.yaml) yaml

---
apiVersion: v1
kind: ReplicationController
metadata:
   name: myapp-rc2
spec:
   replicas: 5
   selector:
      app: myapp
      zone: prod
      version: v2
   template:
      metadata:
         labels:
            app: myapp
            zone: prod
            version: v2
      spec:
         containers:
            - name: myapp-frontendmvc
              image: makader/myapp:frontendmvc-v2
              ports:
                - containerPort: 80


kubectl create -f forntendmvc_rcv2.yaml
kubectl expose rc myapp-rc2 --name=myapp-rc2-service --type=NodePort
kubectl describe service myapp-rc2-service

Change the label version to make the new pods (2nd version of the app) available to the client.

With the same concept, roll back to the v1 version or use the zone label to pass from a test stage to the production stage. 

Labels are entirely customizable and an unlimited number


 

Delete all

kubectl delete replicationcontroller myapp-rc2
kubectl delete service myapp-rc2-service

No comments: