Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no matches for kind "Deployment" in version "extensions/v1beta1"

Tags:

kubernetes

While deploying mojaloop, Kubernetes responds with the following errors:

Error: validation failed: [unable to recognize "": no matches for kind "Deployment" in version "apps/v1beta2", unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1", unable to recognize "": no matches for kind "StatefulSet" in version "apps/v1beta2", unable to recognize "": no matches for kind "StatefulSet" in version "apps/v1beta1"]

My Kubernetes version is 1.16.
How can I fix the problem with the API version?
From investigating, I have found that Kubernetes doesn't support apps/v1beta2, apps/v1beta1.
How can I make Kubernetes use a not deprecated version or some other supported version?

I am new to Kubernetes and anyone who can support me I am happy

like image 265
dan Avatar asked Oct 21 '19 07:10

dan


3 Answers

In Kubernetes 1.16 some apis have been changed.

You can check which apis support current Kubernetes object using

$ kubectl api-resources | grep deployment
deployments                       deploy       apps                           true         Deployment

This means that only apiVersion with apps is correct for Deployments (extensions is not supporting Deployment). The same situation with StatefulSet.

You need to change Deployment and StatefulSet apiVersion to apiVersion: apps/v1.

If this does not help, please add your YAML to the question.

EDIT As issue is caused by HELM templates included old apiVersions in Deployments which are not supported in version 1.16, there are 2 possible solutions:

1. git clone whole repo and replace apiVersion to apps/v1 in all templates/deployment.yaml using script
2. Use older version of Kubernetes (1.15) when validator accept extensions as apiVersion for Deployment and StatefulSet.

like image 185
PjoterS Avatar answered Nov 04 '22 20:11

PjoterS


to convert an older Deployment to apps/v1, you can run:

kubectl convert -f ./my-deployment.yaml --output-version apps/v1
like image 22
aren Avatar answered Nov 04 '22 19:11

aren


You can change manually as an alternative. Fetch the helm chart:

helm fetch --untar stable/metabase

Access the chart folder:

cd ./metabase

Change API version:

sed -i 's|extensions/v1beta1|apps/v1|g' ./templates/deployment.yaml

Add spec.selector.matchLabels:

spec:
[...]
selector:
    matchLabels:
    app: {{ template "metabase.name" . }}
[...]

Finally install your altered chart:

helm install ./ \
  -n metabase \
  --namespace metabase \
  --set ingress.enabled=true \
  --set ingress.hosts={metabase.$(minikube ip).nip.io}

Enjoy!

like image 12
Bruno Wego Avatar answered Nov 04 '22 21:11

Bruno Wego