Kubernetes ReplicationController example of manifest file
apiVersion: v1
kind: ReplicationController
metadata:
name: rc-nginx
spec:
replicas: 3
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx-container
image: nginx
We have 2
metadata sections in the definition file: one for ReplicationController, another for the Pod - and the same for
spec sections: one for each.
The
selector is not a required field in case of ReplicationController, but it is still available. When you skip it, it assumes that it is the same as the Pod labels provided in definition file.