Replication controller is a definition to number of replicas of a pod that should exist. ReplicaSet is a replacement for replication controller.
template element in the below yaml file should be similar to the pod definition as to define the type of pod to be created (eg: https://digicommlearner.blogspot.com/2020/03/kubernetes-basic-yaml-file-for-pod.html)
replicationcontroller.yml
apiVersion: v1
kind: ReplicationController
metadata:
name: repcon
labels:
app: myapp
type: ui
spec:
template:
metadata:
name: myapp-pod1
labels:
app: myapp
type: ui
spec:
containers:
- name: hello-world
image: hello-world
replicas: 2
Sample Scripts -
kubectl create -f replicationcontroller.yml --> creates replication controller with number of pods as that of replicas in the yml file
kubectl get replicationcontroller --> lists the replication controller details
template element in the below yaml file should be similar to the pod definition as to define the type of pod to be created (eg: https://digicommlearner.blogspot.com/2020/03/kubernetes-basic-yaml-file-for-pod.html)
replicationcontroller.yml
apiVersion: v1
kind: ReplicationController
metadata:
name: repcon
labels:
app: myapp
type: ui
spec:
template:
metadata:
name: myapp-pod1
labels:
app: myapp
type: ui
spec:
containers:
- name: hello-world
image: hello-world
replicas: 2
Sample Scripts -
kubectl create -f replicationcontroller.yml --> creates replication controller with number of pods as that of replicas in the yml file
kubectl get replicationcontroller --> lists the replication controller details
No comments:
Post a Comment