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

10/21/2019

I have been having the issue while deploying mojaloop .kubernetes is responding with an error log like

I have checked my Kubernetes version and 1.16 is the version so how can I fix such kind of problem with the API version .from investigating I have found that Kubernetes don't support apps/v1beta2, apps/v1beta1 so how can I make Kubernetes to use currently not deprecated version or supported version I am new to Kubernetes and anyone who can support me I am happy

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"]

-- dan
kubernetes

4 Answers

4/9/2020

to put it simple you dont force the current installation to use an outdated version of the API , but you simply fix the version in your config files if you want to check which version you current kube supports , simply run :

root@ubn64:~# kubectl api-versions | grep -i apps

apps/v1

root@ubn64:~#

-- Shareef
Source: StackOverflow

11/8/2019

This was annoying me because I am testing lots of helm packages so I wrote a quick script - which could be modified to sort your workflow perhaps see below

New workflow First fetch the chart as a tgz to your working directory

helm fetch repo/chart

then in your working directly run bash script below - which I named helmk

helmk myreleasename mynamespace chart.tgz [any parameters for kubectl create]

Contents of helmk - need to edit your kubeconfig clustername to work

#!/bin/bash
echo usage $0 releasename namespace chart.tgz [createparameter1] [createparameter2] ... [createparameter n]
echo This will use your namespace then shift back to default so be careful!!
kubectl create namespace $2   #this will create harmless error if namespace exists have to ignore
kubectl config set-context MYCLUSTERNAME --namespace $2
helm template -n $1 --namespace $2 $3 | kubectl convert -f /dev/stdin | kubectl create --save-config=true ${@:4}  -f /dev/stdin
#note the --namespace parameter in helm template above seems to be ignored so we have to manually switch context
kubectl config set-context MYCLUSTERNAME --namespace default

It's a slightly dangerous hack since I manually switch to your new desired namespace context then back again so only to be used for single user devs really or comment that out.

You will get a warning about using the kubectl convert facility like this

If you need to edit the YAML to customise - just replace one of the /dev/stdin to intermediate files but It's probably better to get it up using "create" with a save-config as I have and then simply "apply" your changes which means that they will be recorded in kubernetes too. Good luck

-- john beck
Source: StackOverflow

10/21/2019

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.

-- PjoterS
Source: StackOverflow

11/25/2019

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!

-- Bruno Wego
Source: StackOverflow