I am trying to run ReplicaSet.
I have this yaml file
apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: nginxrs
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.12-alpine
ports:
- containerPort: 80
This file is called nginx-rs.yaml
Next, In terminal use command
kubectl apply -f nginx-rs.yaml
And I have this error
error: unable to recognize "nginx-rs.yaml": no matches for kind "ReplicaSet" in version "extensions/v1beta1"
Thanks for pointing out where did I go wrong?
In kubernetes 1.16 replicaset was moved to apps/v1
apiVersion
from extensions/v1beta1
. Hence the yaml should be as below
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: nginxrs
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.12-alpine
ports:
- containerPort: 80