I am trying to create a deployment declaratively, using kubectl apply
. The below configuration is created just fine when I do
kubectl create -f postgres-deployment.yaml
but if I go
kubectl apply -f postgres-deployment.yaml
I am presented with the lovely error message:
error: unable to decode "postgres-deployment.yaml": no kind "Deployment" is registered for version "apps/v1beta1"
I have tried searching for an explanation to what this means but I cannot figure it out.
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: postgres-deployment
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:10.1
ports:
- containerPort: 5432
Old Kubernetes versions supported the Deployment object on the extensions/v1beta1
API group. That is no longer the case.
For Kubernetes versions before 1.9.0 you should use the API group apps/v1beta2
.
In Kubernetes 1.9 and above you should use the API group apps/v1
.