Created
July 13, 2018 08:32
-
-
Save joshy91/a9ad1f49f2be5c379714d9d53d83c657 to your computer and use it in GitHub Desktop.
Replication Controller and Replica Set yamls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Replication Controller and Replica Set yamls | |
#A replication controller is a precusor to a deployment | |
echo “apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: nginx | |
spec: | |
replicas: 3 | |
selector: | |
app: nginx | |
template: | |
metadata: | |
name: nginx | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: nginx | |
ports: | |
- containerPort: 80” >> nginx-repcontroller.yaml | |
#Create Nginx Replication Controller | |
kubectl create -f nginx-repcontroller.yaml | |
#Delete Nginx Replication Controller | |
kubectl delete -f nginx-repcontroller.yaml | |
#A replica set is an “advanced” version of a replication controller | |
echo “apiVersion: v1 | |
kind: ReplicaSet | |
metadata: | |
name: nginx | |
spec: | |
replicas: 3 | |
selector: | |
app: nginx | |
template: | |
metadata: | |
name: nginx | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: nginx | |
ports: | |
- containerPort: 80” >> nginx-replicaset.yaml | |
#Create Nginx Replica Set | |
kubectl create -f nginx-repcontroller.yaml | |
#Delete Nginx Replica Set | |
kubectl delete -f nginx-repcontroller.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment