I am a bit confused on this kubernetes yaml file. The first 'spec' says there need to be 3 replicas all the time.
How about the second 'spec' that just above 'containers'. Also, what does the template thing do ?
apiVersion: v1
kind: ReplicationController
metadata:
name: node-js
labels:
name: node-js
spec:
replicas: 3
selector:
name: node-js
template:
metadata:
labels:
name: node-js
spec:
containers:
- name: node-js
image: jonbaier/node-express-info:latest
ports:
- containerPort: 80
The first spec is for settings of the ReplicationController itself.
Block named "template" and "spec" in it is a pod template with a configuration of the pod which you want to run by your replication controller:
apiVersion: v1 kind: ReplicationController metadata: name: node-js labels: name: node-js spec: # related to ReplicationController itself replicas: 3 # value 3 mean that you want to launch 3 replicas of a pod selector: name: node-js template: # section with a pod template metadata: labels: name: node-js spec: # related to a container you want to run containers: - name: node-js image: jonbaier/node-express-info:latest ports: - containerPort: 80