Skip to content

Instantly share code, notes, and snippets.

@joshy91
Created July 13, 2018 08:32
Show Gist options
  • Save joshy91/a9ad1f49f2be5c379714d9d53d83c657 to your computer and use it in GitHub Desktop.
Save joshy91/a9ad1f49f2be5c379714d9d53d83c657 to your computer and use it in GitHub Desktop.
Replication Controller and Replica Set yamls
#!/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