花了一个上午来追踪问题,k8s都反复新建了十多次,docker都重启了几次。(一次显示不有获取磁盘空间,重启docker,清空存储解决)

在用kubeadm安装容器化的几个组件时,flannel组件死活不能启动,报如下问题:

Failed to create SubnetManager: error retrieving pod spec for 'kube-system/kube-flannel-ds-xxx': the server does not allow access to the requested resource.

在如下Url找到解决办法:

http://blog.csdn.net/ximenghappy/article/details/70157361

明天搞DNS和节点加入....

================================================

Kubernetes一共提供五种网络组件,可以根据自己的需要选择。我使用的Flannel网络,此处1.5.5和1.6.1也是不一样的,1.6.1加了RBAC。需要执行一下两个命令:

kubectl create -f https://github.com/coreos/flannel/raw/master/Documentation/kube-flannel-rbac.yml
clusterrole "flannel" configured
clusterrolebinding "flannel" configured

kubectl create -f  https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
serviceaccount "flannel" created
configmap "kube-flannel-cfg" created
daemonset "kube-flannel-ds" created

  解决此问题参考: 
https://github.com/kubernetes/kubernetes/issues/44029 
https://github.com/kubernetes/kubeadm/issues/212#issuecomment-290908868

kube-flannel-rbac.yaml文件内容:

# Create the clusterrole and clusterrolebinding:
# $ kubectl create -f kube-flannel-rbac.yml
# Create the pod using the same namespace used by the flannel serviceaccount:
# $ kubectl create --namespace kube-system -f kube-flannel.yml
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: flannel
rules:
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
  - apiGroups:
      - ""
    resources:
      - nodes
    verbs:
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - nodes/status
    verbs:
      - patch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: flannel
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: flannel
subjects:
- kind: ServiceAccount
  name: flannel
  namespace: kube-system

kube-flannel.yaml内容:

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: flannel
  namespace: kube-system
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: kube-system
  labels:
    tier: node
    app: flannel
data:
  cni-conf.json: |
    {
      "name": "cbr0",
      "type": "flannel",
      "delegate": {
        "isDefaultGateway": true
      }
    }
  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "vxlan"
      }
    }
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: kube-flannel-ds
  namespace: kube-system
  labels:
    tier: node
    app: flannel
spec:
  template:
    metadata:
      labels:
        tier: node
        app: flannel
    spec:
      hostNetwork: true
      nodeSelector:
        beta.kubernetes.io/arch: amd64
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      serviceAccountName: flannel
      containers:
      - name: kube-flannel
        image: quay.io/coreos/flannel-amd64:v0.7.1
        command: [ "/opt/bin/flanneld", "--ip-masq", "--kube-subnet-mgr" ]
        securityContext:
          privileged: true
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        volumeMounts:
        - name: run
          mountPath: /run
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      - name: install-cni
        image: quay.io/coreos/flannel-amd64:v0.7.1
        command: [ "/bin/sh", "-c", "set -e -x; cp -f /etc/kube-flannel/cni-conf.json /etc/cni/net.d/10-flannel.conf; while true; do sleep 3600; done" ]
        volumeMounts:
        - name: cni
          mountPath: /etc/cni/net.d
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      volumes:
        - name: run
          hostPath:
            path: /run
        - name: cni
          hostPath:
            path: /etc/cni/net.d
        - name: flannel-cfg
          configMap:
            name: kube-flannel-cfg

在k8s中安装flannel的故障解决: Failed to create SubnetManager: error retrieving pod spec for : the server does not allow access to the requested resource的更多相关文章

  1. Apache 2.4.7在CentOS6.4中安装配置反向代理解决单外网IP对应多个内网主机的方法实践

    欢迎转载,转载时请保留全文及出处. Apache 2.4.7在CentOS6.4中安装配置反向代理解决单外网IP对应多个内网主机的方法实践 Apache安装 下载源程序(http://httpd.ap ...

  2. 新版的K8S中的flannel.yaml文件中要注意的细节

    部署flannel作为k8s中的网络插件,yaml文件都大小同异. 但在要注意以下细节. 以前,只需要前面master判断. 现在也需要有not-ready状态了. tolerations: - ke ...

  3. PandorBox 中安装aria2失败的解决办法

    来自:http://www.right.com.cn/forum/thread-174358-1-1.html 不论luci界面还是opkg中安装,都提示缺少依赖包uclibc,pandorabox默 ...

  4. phpstorm failed to create jvm:error code -6 解决办法 解决方法

    phpStorm 软件打开运行提示 failed to create JVM的解决办法. 修改文件 D:\Program Files (x86)\JetBrains\PhpStorm 7.1.3\bi ...

  5. rsync安装配置及故障解决完全教程[window, 文件同步]

    Rsync是的全称是: remote synchronize, 也就是远程同步数据, 它是一款不错的文件同步软件,而且是免费的, 它在镜像保存整个目录树和文件系统的同时保持原来文件的权限.时间.软硬链 ...

  6. CentOS7在VMWare12中安装后不能上网解决办法

    首先要保证你的VMWare Workstation12 在安装号CentOS7后没改动什么关于网络相关的. 1.我的电脑一开始用的是VMWare WorkStations10,发现VMnet8根本不通 ...

  7. k8s中安装rabbitmq集群

    官方文档地址:https://www.rabbitmq.com/kubernetes/operator/quickstart-operator.html 要求 1.k8s版本要1.18及其以上 2.能 ...

  8. 在K8S中安装jenkins

    以 NFS 为存储卷的示例,将在 NFS 存储卷上创建 Jenkins 目录,然后创建 NFS 类型的 PV.PVC. 1.NFS 存储卷创建 Jenkins 目录 进入 NFS Server 服务器 ...

  9. Python爬虫html解析工具beautifulSoup在pycharm中安装及失败的解决办法

    1.安装步骤: 首先,你要先进入pycharm的Project Interpreter界面,进入方法是:setting(ctrl+alt+s) ->Project Interpreter,Pro ...

随机推荐

  1. vim 打开中文乱码

    [root@yu ~]# find / -name vimrc/etc/vimrc [root@yu ~]# vim /etc/vimrc set fileencodings=utf-8,gb2312 ...

  2. 推荐一款JQuery星形评级插件

    jRating 是一个非常灵活的jQuery插件用于快速创建一个Ajax星型投票系统.可以设置星型数量和小数支持.功能很强大,具体大家可以看一下这个插件的js代码就知道了,下面这里演示一下这个插件有哪 ...

  3. Linux系统通过AWS命令行上传文件至S3

    打开你的AWS控制台: 在IAM中创建一个新用户(比如test),创建时它会自动创建一个用户安全凭证,是由“访问密钥ID”和“私有访问密钥”组成的,请记住它并下载该凭证,后面会用到它: 选择你刚创建的 ...

  4. Hadoop Yarn事件处理框架源码分析

    由于想在项目中使用类似yarn的事件处理机制,就看了实现.主要是由Dispatcher.java,EventHandler.java,Service.java这3个类撑起来的. 在事件处理之前,先注册 ...

  5. X210(s5pv210)中断系统

    1.SoC对中断的实现机制:异常向量表 (1)异常向量表是CPU中某些特定地址的特定定义.当中断发生的时候,中断要想办法通知CPU去处理中断,怎么做到?这就要靠异常向量表.(2)在CPU设计时,就事先 ...

  6. python 基础--pip(转)

    感谢:http://www.cnblogs.com/csucat/p/4897695.html python需要用到一些其他的库,可以手动去各个库的官网下载,自己安装:也可以安装pip,使用pip可以 ...

  7. 数据结构:Treap

    关于重量平衡树的相关概念可以参考姊妹文章:重量平衡树之替罪羊树 Treap是依靠旋转来维护平衡的重量平衡树中最为好写的一中,因为它的旋转不是LL就是RR 对于每一个新的节点,它给这个节点分配了一个随机 ...

  8. [洛谷P3460] [POI2007]TET-Tetris Attack

    洛谷题目链接:[POI2007]TET-Tetris Attack 题目描述 A puzzle called "Tetris Attack" has lately become a ...

  9. 【设计模式】 模式PK:策略模式VS桥梁模式

    1.概述 我们先来看两种模式的通用类图. 两者之间确实很相似.如果把策略模式的环境角色变更为一个抽象类加一个实现类,或者桥梁模式的抽象角色未实现,只有修正抽象化角色,想想看,这两个类图有什么地方不一样 ...

  10. Freemarker <#list List/Map/Array[] as Object>

    http://blog.csdn.net/ani521smile/article/details/52164366 详细教程链接