我在部署mojaloop .kubernetes时遇到问题,并显示错误日志,例如
我已经检查了我的Kubernetes版本,而1.16是该版本,所以我该如何解决API版本的这种问题。从调查中发现Kubernetes不支持apps / v1beta2,apps / v1beta1,所以我如何使Kubernetes成为使用当前未弃用的版本或受支持的版本我是Kubernetes的新手,任何可以支持我的人我都很高兴
错误:验证失败:[无法识别“”:版本“ apps / v1beta2”中没有与类型“ Deployment”匹配,无法识别“”:版本“ extensions / v1beta1”中没有与类型“ Deployment”匹配,无法识别“”:版本“ apps / v1beta2”中没有匹配类型“ StatefulSet”,无法识别“”:版本“ apps / v1beta1”中没有匹配类型“ StatefulSet”]
小智 16
要将旧部署转换为 apps/v1,您可以运行:
kubectl convert -f ./my-deployment.yaml --output-version apps/v1
Run Code Online (Sandbox Code Playgroud)
Bru*_*ego 11
作为替代,您可以手动更改。获取舵图:
helm fetch --untar stable/metabase
Run Code Online (Sandbox Code Playgroud)
访问图表文件夹:
cd ./metabase
Run Code Online (Sandbox Code Playgroud)
更改 API 版本:
sed -i 's|extensions/v1beta1|apps/v1|g' ./templates/deployment.yaml
Run Code Online (Sandbox Code Playgroud)
添加spec.selector.matchLabels
:
spec:
[...]
selector:
matchLabels:
app: {{ template "metabase.name" . }}
[...]
Run Code Online (Sandbox Code Playgroud)
最后安装你修改过的图表:
helm install ./ \
-n metabase \
--namespace metabase \
--set ingress.enabled=true \
--set ingress.hosts={metabase.$(minikube ip).nip.io}
Run Code Online (Sandbox Code Playgroud)
享受!
Pjo*_*erS 10
在Kubernetes 1.16中api
已进行了一些更改。
您可以使用以下命令检查哪些API支持当前的Kubernetes对象
$ kubectl api-resources | grep deployment
deployments deploy apps true Deployment
Run Code Online (Sandbox Code Playgroud)
这意味着只有apiVersion具有才适用apps
于Deployments(extensions
不支持Deployment
)。与StatefulSet相同的情况。
您只需要将Deployment和StatefuSet apiVersion更改为即可apiVersion: apps/v1
。
如果这样做没有帮助,请添加您的YAML问题。
编辑
由于问题是由部署中包含旧apiVersions的HELM模板引起的,而版本1.16中不支持该版本,因此有2种可能的解决方案:
1. git clone
整个回购和替换apiVersion到apps/v1
的所有模板/ deployment.yaml使用脚本
2.使用旧版本的Kubernetes的(1.15)时,验证接受extensions
的apiVersion
用于Deployent
和StatefulSet
。
小智 8
简而言之,您不会强制当前安装使用过时版本的 API;您修复配置文件中的版本。如果您想检查当前 kube 支持哪个版本,请运行:
root@ubn64:~# kubectl api-versions | grep -i apps
apps/v1
Run Code Online (Sandbox Code Playgroud)
我收到以下错误 -
错误:无法识别“deployment.yaml”:版本“extensions/v1beta1”中没有与类型“Deployment”匹配的内容
对我有用的解决方案 -
将deployment.yaml中的行从 apiVersion:extensions/v1beta1 修改为 apiVersion:apps/v1
原因 - 我们升级了 K8 集群,因此发生了此错误。
我更喜欢kubectl explain
。
# kubectl explain deploy
KIND: Deployment
VERSION: apps/v1
DESCRIPTION:
Deployment enables declarative updates for Pods and ReplicaSets.
FIELDS:
apiVersion <string>
APIVersion defines the versioned schema of this representation of an
object. Servers should convert recognized schemas to the latest internal
value, and may reject unrecognized values. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kind <string>
Kind is a string value representing the REST resource this object
represents. Servers may infer this from the endpoint the client submits
requests to. Cannot be updated. In CamelCase. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadata <Object>
Standard object metadata.
spec <Object>
Specification of the desired behavior of the Deployment.
status <Object>
Most recently observed status of the Deployment.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4197 次 |
最近记录: |