Running an Example ReplicationController
By using the following yaml file you can run the tomcat as a container in the Kubernetes cluster. Create a yaml file with the name tomcat.yaml and paste the following code in that file.
apiVersion: v1
kind: ReplicationController
metadata:
name: tomcat
spec:
replicas: 3
selector:
app: tomcat
template:
metadata:
name: tomcat
labels:
app: tomcat
spec:
containers:
- name: tomcat
image: tomcat:latest
ports:
- containerPort: 8080
After creating yaml file know to run the yaml file by using the following command:
kubectl. apply -f tomcat.yaml
If you get the output as the following:
replicationcontroller/tomcat created
Then that your replication controller is created successfully. You can check the status of replication by using the following command.
kubectl describe replicationcontrollers/tomcat
Kubernetes – Replication Controller
With the help of the open-source container orchestration technology Kubernetes, software deployment, scalability, and management are mostly automated. Another name for Kubernetes is K8s. Google created Kubernetes, which is now overseen by the Cloud Native Computing Foundation. Even though it now works with CRI-O as well as Docker runtime, with which it was initially intended to work. Automating operational activities for container management is Kubernetes’ primary goal. It has built-in capabilities for deploying apps and rolling out necessary application modifications. Businesses like Google, Spotify, and Capital One currently use it.