I'm trying to run the command "oc apply -f basic-ocp-demo.yaml" in order to create services and deployment in my openshift, but I get an error regarding "unable to decode "basic-ocp-demo.yaml ": no kind "Deployment" is registered for version "v1beta1 "
My file look like :
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
type: NodePort
selector:
app: nginx-app
type: front-end
ports:
- port: 80
targetPort: 80
nodePort: 30012
---
kind: Deployment
apiVersion: v1beta1
metadata:
name: nginx-deployment
labels:
app: nginx-app
type: front-end
spec:
replicas: 3
selector:
matchLabels:
app: nginx-app
type: front-end
template:
metadata:
labels:
app: nginx-app
type: front-end
spec:
containers:
- name: nginx-container
image: nginx:latest
oc apply command output:
[root@localhost openshift]# oc apply -f basic-ocp-demo.yaml
service "nginx-service" created
error: unable to decode "basic-ocp-demo.yaml": no kind "Deployment" is registered for version "v1beta1"
Seems that my service nginx was created but the Deployment kind has no registration for version "v1bet1", I tried to put many other version but the same problem:
I've tried with "apps/v1", the same issue:
error: unable to decode "basic-ocp-demo.yaml": no kind "Deployment" is registered for version "apps/v1"
I've made a curl where can be seen all the apis available but I don't know what to choose from that list for my Deployment Kind.
Here is my apis list : https://92.42.107.195:8443/apis
Please use the command oc api-resources
to list all the resources and use the mentioned version API version from the list for the deployment.
It would appear you are running an extremely old version of OpenShift/Kubernetes. So all you have available is apps/v1alpha1
. You should upgrade ASAP.