serving the solutions day and night


Sunday, August 16, 2020

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.


apiVersion: v1
kind: ReplicationController
 name: myapp-rc
   replicas: 5  
     app: myapp    
         app: myapp           
         zone: prod           
         version: v1        
         - name:myapp-frontendmvc              
           image: makader/myapp:frontendmvc-v1              
             - containerPort:80
  • In the specification block, indicate the number of replicas for the pod. 
  • The selector label to indicate which pod will be replicated
  • The template with the information about the pod. 
  • The pod definition is the same as the previous script, so if you don’t remove the previous pod, the replication controller will create only four pods. 

kubectl create -f forntendmvc_rc.yml


Delete the frontendmvc pod and observe how the replication controller will add a new pod to maintain the desired state of five replicas

kubectl delete pod forntendmvc-pod  


No comments: