部署flannel作为k8s中的网络插件,yaml文件都大小同异。

但在要注意以下细节。

以前,只需要前面master判断。

现在也需要有not-ready状态了。

tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: node.kubernetes.io/not-ready
operator: Exists
effect: NoSchedule

---
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
---
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",
      "plugins": [
        {
          "type": "flannel",
          "delegate": {
            "hairpinMode": true,
            "isDefaultGateway": true
          }
        },
        {
          "type": "portmap",
          "capabilities": {
            "portMappings": true
          }
        }
      ]
    }
  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "vxlan",
        "Directrouting": true
      }
    }
---
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
      - key: node.kubernetes.io/not-ready
        operator: Exists
        effect: NoSchedule
      serviceAccountName: flannel
      initContainers:
      - name: install-cni
        image: harbor.paic.com.cn/3rd_part/quay.io/coreos/flannel:v0.11.0-amd64
        command:
        - cp
        args:
        - -f
        - /etc/kube-flannel/cni-conf.json
        - /etc/cni/net.d/10-flannel.conflist
        volumeMounts:
        - name: cni
          mountPath: /etc/cni/net.d
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      containers:
      - name: kube-flannel
        image: harbor.paic.com.cn/3rd_part/quay.io/coreos/flannel:v0.11.0-amd64
        command:
        - /opt/bin/flanneld
        args:
        - --ip-masq
        - --kube-subnet-mgr
        resources:
          requests:
            cpu: "200m"
            memory: "200Mi"
          limits:
            cpu: "500m"
            memory: "500Mi"
        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/
      volumes:
        - name: run
          hostPath:
            path: /run
        - name: cni
          hostPath:
            path: /etc/cni/net.d
        - name: flannel-cfg
          configMap:
            name: kube-flannel-cfg

新版的K8S中的flannel.yaml文件中要注意的细节的更多相关文章

  1. day11_单元测试_读取yaml文件中的用例,自动获取多个yaml文件内容执行生成报告

    一.使用.yaml格式的文件直接可以存放字典类型数据,如下图,其中如果有-下一行有缩进代表这是个list,截图中是整体是一个list,其中有两部分,第二部分又包含另外一个list 二.单元测试:开发自 ...

  2. java算法面试题:编写一个程序,将a.txt文件中的单词与b.txt文件中的单词交替合并到c.txt文件中,a.txt文件中的单词用回车符分隔,b.txt文件中用回车或空格进行分隔。

    package com.swift; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File ...

  3. mybatis中的map.xml文件中sql语句需要分号吗?

    mybatis中的map.xml文件中sql语句需要分号吗? :你是说sql介绍的分号吗?不需要的

  4. YAML文件中在单一文件中区分多个文件

    1.在单一文件中,可用连续三个连字号(---)区分多个文件. 2.另外,还有选择性的连续三个点号( ... )用来表示文件结尾. 题外:YAML其实语法很多也很灵活,但是针对Spring支持的语法其实 ...

  5. Python--代码1(接口测试:测试用例从数据库读取写到yaml文件中)

    一. 从数据库中读取全部接口,并写入yaml文件 数据库中的数据存储格式如下图: import pymysql import os import json # from ruamel import y ...

  6. K8S创建的相关yaml文件

    一.K8S-yaml的使用及命令 YAML配置文件管理对象 对象管理: # 创建deployment资源 kubectl create -f nginx-deployment.yaml # 查看dep ...

  7. Yaml 文件中Condition If- else 判断的问题

    在做项目的CI/ CD 时,难免会用到 Travis.CI 和 AppVeyor 以及 CodeCov 来判断测试的覆盖率,今天突然遇到了一个问题,就是我需要在每次做测试的时候判断是否存在一个环境变量 ...

  8. SpringMVC 实现POI读取Excle文件中数据导入数据库(上传)、导出数据库中数据到Excle文件中(下载)

    读取Excale表返回一个集合: package com.shiliu.game.utils; import java.io.File; import java.io.FileInputStream; ...

  9. 在文件夹中 的指定类型文件中 查找字符串(CodeBlocks+GCC编译,控制台程序,仅能在Windows上运行)

    说明: 程序使用 io.h 中的 _findfirst 和 _findnext 函数遍历文件夹,故而程序只能在 Windows 下使用. 程序遍历当前文件夹,对其中的文件夹执行递归遍历.同时检查遍历到 ...

随机推荐

  1. Java基础2-基本语法

    复习 jvm : 虚拟机 --> sandbox jre : jvm + 核心类库 jdk : jre + 工具,javac java path: 操作系统搜索路径 classpath: jav ...

  2. 数据备份、pymysql模块

    阅读目录 一 IDE工具介绍 二 MySQL数据备份 三 pymysql模块 一 IDE工具介绍 生产环境还是推荐使用mysql命令行,但为了方便我们测试,可以使用IDE工具 下载链接:https:/ ...

  3. python使用PDB进行调试

    参考链接:https://www.cnblogs.com/xiaohai2003ly/p/8529472.html 调入包:import pdb 调试时的一些命令: (1)p  变量名:查看变量:(p ...

  4. Linux Makefile 生成 *.d 依赖文件及 gcc -M -MF -MP 等相关选项说明【转】

    转自:https://blog.csdn.net/qq1452008/article/details/50855810 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog. ...

  5. bug笔记(pc)

    1.如果a标签中的href没有设置,那么点击的这个按钮的时候,这个页面会自动刷新!!! Bug:   <a href=”” class=”btn”></a>类似这种情况,点击a ...

  6. $Django 图片验证刷新 上传头像

    1.图片验证刷新 $('img').click(function () { $('img')[0].src+='?' }) 2.上传头像 1.模板 <div class="form-g ...

  7. css效果文字多了就...

    开发中经常会遇见这样的问题,一段文字或者一段标题过长了,就让超出长度的部分益...替换.具体怎么做的呢?直接上代码: <style> *{ margin: 0; padding: 0; } ...

  8. MYSQL 查看最大连接数和修改最大连接数

    MySQL查看最大连接数和修改最大连接数 1.查看最大连接数show variables like '%max_connections%';2.修改最大连接数set GLOBAL max_connec ...

  9. [nodejs]er_bad_field_error NaN in where clause

    1 前言 nodejs 运行时,出现以下情况er_bad_field_error NaN in where clause. 2 分析 原来是userid = NAN传进来了,生成userid时出错了. ...

  10. Day6------------软连接和硬链接

    一.块 1.操作系统分四大类块 super block 掌管全局 inode block directory block block 2.删文件 普通删除只是删除链接,数据还在硬盘 彻底删除:覆盖操作 ...