serving the solutions day and night

Pages

Showing posts with label POD. Show all posts
Showing posts with label POD. Show all posts

Sunday, August 16, 2020

Access ASP.NET Core MVC Application with Kubernetes and NodePort

Execute the command "kubectl describe pod myapp-rc-wl284",  each of them is running on a specific IP, internal to the node.  

The Node IP (192.168.65.3), but you can’t access it directly because the forwarding rule to send the requests from the node IP to the pod IP is missing.


Kubernetes ReplicationController

Create multiple instances of the pod using a ReplicationController, which is a master controller that replicates the specified pods, balances them on all the nodes, and reacts if some pod dies to restore the desired state.

forntendmvc_rc.yaml 

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

Deploy ASP.NET Core Application images in Kubernetes (K8s) & POD

Publish the image in Docker Hub

Rename the image tag from frontendmvc:v1, to <account_username>/<repository_name>:<tag> (in our case, makdockerhub/myapp:frontendmvc-v1). 

docker tag frontendmvc makader/myapp:frontendmvc-v1

Publish the image with the docker push command. 

  docker push makader/myapp:frontendmvc-v1

 

 

Now we can deploy a frontendmvc container everywhere (aws, azure, pcf, Kubernetes,...).