简体   繁体   English

法兰绒步骤中的Kubernetes安装错误

[英]Kubernetes installation error in flannel step

I am installing kubernetes using kubeadm on GCP Centos VM and I am getting the following error while running flannel step.我正在 GCP Centos VM 上使用 kubeadm 安装 kubernetes,并且在运行 flannel 步骤时出现以下错误。

Error:错误:

[root@master ~]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
unable to recognize "https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml": no matches for kind "DaemonSet" in version "extensions/v1beta1"
unable to recognize "https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml": no matches for kind "DaemonSet" in version "extensions/v1beta1"
unable to recognize "https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml": no matches for kind "DaemonSet" in version "extensions/v1beta1"
unable to recognize "https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml": no matches for kind "DaemonSet" in version "extensions/v1beta1"
unable to recognize "https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml": no matches for kind "DaemonSet" in version "extensions/v1beta1"

What changes shall I made in order to fix this?为了解决这个问题,我应该做哪些更改?

Use flannel yaml from the official documentation使用官方文档中的flannel yaml

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel configured
clusterrolebinding.rbac.authorization.k8s.io/flannel unchanged
serviceaccount/flannel unchanged
configmap/kube-flannel-cfg configured
daemonset.apps/kube-flannel-ds-amd64 created
daemonset.apps/kube-flannel-ds-arm64 created
daemonset.apps/kube-flannel-ds-arm created
daemonset.apps/kube-flannel-ds-ppc64le created
daemonset.apps/kube-flannel-ds-s390x created

As @suren correctly mention - the issue is in the apiVersion: extensions/v1beta1正如@suren 正确提到的那样 - 问题出在apiVersion: extensions/v1beta1

In latest yaml it looks like在最新的 yaml 中,它看起来像

---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-flannel-ds-amd64
  namespace: kube-system
  labels:
    tier: node
    app: flannel
spec:
  selector:
    matchLabels:
      app: flannel
  template:
    metadata:
      labels:
        tier: node
        app: flannel
...

That's a versioning issue with the DaemonSet and your kubernetes cluster.这是 DaemonSet 和您的 kubernetes 集群的版本控制问题。 You are using extensions/v1beta1 , but DaemonSets have been promoted to apps/v1 .您正在使用extensions/v1beta1 ,但DaemonSets已升级为apps/v1

If you already have api-server running, try kubectl explain daemonset , and it will tell you what should be the apiVersion for the DaemonSets .如果您已经运行了api-server ,请尝试kubectl explain daemonset ,它会告诉您apiVersionDaemonSets应该是什么。

If not, just download the flannel file, edit it, change the apiVersion: extensions/v1beta1 , by apiVersion: apps/v1 , and it should work.如果没有,只需下载法兰绒文件,编辑它,更改apiVersion: extensions/v1beta1 ,通过apiVersion: apps/v1 ,它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM