Pages

Tuesday, August 25, 2020

Deploy ASP.NET CORE application with the Kubernetes Deployments

Update the application with a rolling update strategy that releases new pods more gradually, one pod at a time. 

Roll back the application to a specific version of the deploy history using the deployment. 

Run the command without --restart=Never (Deploy ASP.NET Core Application images in Kubernetes (K8s) & POD). Command to create a simple deployment 

 kubectl run frontendmvcv1 --image=makader/myapp:frontendmvc-v1 --port 80 

kubectl get deployment frontendmvcv1

The info about the deployment: the desired replica of the pod/the current pods, the up-to-date pods, and the available pods.

It manages the desired state of the application for us and reacts if something happens to alter this state.  

Delete the deployment 

  kubectl delete deploymnet frontendmvcv1

Deployment using YAML (deployment.yaml)

--- apiVersion: apps/v1 kind: Deployment metadata: name: myapp-deployment spec: replicas: 3 selector: matchLabels: app: myapp template: metadata: labels: app: myapp zone: prod version: v1 spec: containers: - name: myapp-frontendmvc image: makader/myapp:frontendmvc-v1 ports: - containerPort: 80

Similar to the replication controller, except the selector is more explicit about the label mechanism to match the pods.

kubectl create -f deployment.yaml

"myapp-deployment" deployment created by the system, which you can analyze using the command.

kubectl describe deployment myapp-deployment

 A deployment automatically creates a ReplicaSet to manage the replicas and the update strategies configured. 

The information about the deployment

The replicas, the strategy type(default is RollingUpdate), the rolling update strategy parameters that are specific for each strategy type. 

The Kubernetes element: ReplicaSet (more flexible than the replication controller)

update strategies 

 

No comments:

Post a Comment