我是靠谱客的博主 生动早晨,最近开发中收集的这篇文章主要介绍CentOS7 AltArch aarch64环境kubeasz flannel : 轮询等待flannel 运行,视下载镜像速度而定,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

故障

TASK [flannel : 检查是否已下载离线flannel镜像] ******************************************************************************************************************
changed: [192.168.111.193]

TASK [flannel : 尝试推送离线docker 镜像(若执行失败,可忽略)] **********************************************************************************************************
ok: [192.168.111.193] => (item=pause.tar)
ok: [192.168.111.193] => (item=flannel_v0.12.0.tar)

TASK [flannel : 获取flannel离线镜像推送情况] *******************************************************************************************************************
changed: [192.168.111.193]

TASK [flannel : 导入 flannel的离线镜像(若执行失败,可忽略)] **********************************************************************************************************
changed: [192.168.111.193] => (item=pause.tar)
changed: [192.168.111.193] => (item=flannel_v0.12.0.tar)

TASK [flannel : 导入 flannel的离线镜像(若执行失败,可忽略)] **********************************************************************************************************

TASK [flannel : 运行 flannel网络] ************************************************************************************************************************
changed: [192.168.111.193]

TASK [flannel : 删除默认cni配置] ***************************************************************************************************************************
changed: [192.168.111.193]

TASK [flannel : 轮询等待flannel 运行,视下载镜像速度而定] ************************************************************************************************************
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (15 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (14 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (13 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (12 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (11 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (10 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (9 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (8 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (7 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (6 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (5 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (4 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (3 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (2 retries left).
FAILED - RETRYING: 轮询等待flannel 运行,视下载镜像速度而定 (1 retries left).
fatal: [192.168.111.193]: FAILED! => {"attempts": 15, "changed": true, "cmd": "/opt/kube/bin/kubectl get pod -n kube-system -o wide|grep 'flannel'|grep ' 192.168.111.193 '|awk '{print $3}'", "delta": "0:00:00.175250", "end": "2020-09-01 09:59:32.723445", "rc": 0, "start": "2020-09-01 09:59:32.548195", "stderr": "No resources found in kube-system namespace.", "stderr_lines": ["No resources found in kube-system namespace."], "stdout": "", "stdout_lines": []}
...ignoring

对应playbook内容

# 【可选】推送离线docker 镜像,可以忽略执行错误
- block:
    - name: 检查是否已下载离线flannel镜像
      command: "ls {{ base_dir }}/down"
      register: download_info
      connection: local
      run_once: true

    - name: 尝试推送离线docker 镜像(若执行失败,可忽略)
      copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }}
      when: 'item in download_info.stdout'
      with_items:
      - "pause.tar"
      - "{{ flannel_offline }}"
      ignore_errors: true

    - name: 获取flannel离线镜像推送情况
      command: "ls /opt/kube/images"
      register: image_info

    # 如果目录下有离线镜像,就把它导入到node节点上
    - name: 导入 flannel的离线镜像(若执行失败,可忽略)
      shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ item }}"
      with_items:
      - "pause.tar"
      - "{{ flannel_offline }}"
      ignore_errors: true
      when: "item in image_info.stdout and CONTAINER_RUNTIME == 'docker'"

    - name: 导入 flannel的离线镜像(若执行失败,可忽略)
      shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ item }}"
      with_items:
      - "pause.tar"
      - "{{ flannel_offline }}"
      ignore_errors: true
      when: "item in image_info.stdout and CONTAINER_RUNTIME == 'containerd'"

# 只需单节点执行一次
- name: 运行 flannel网络
  shell: "{{ bin_dir }}/kubectl apply -f /opt/kube/kube-system/flannel.yaml"
  run_once: true

# 删除原有cni配置
- name: 删除默认cni配置
  file: path=/etc/cni/net.d/10-default.conf state=absent

# 等待网络插件部署成功,视下载镜像速度而定
- name: 轮询等待flannel 运行,视下载镜像速度而定
  shell: "{{ bin_dir }}/kubectl get pod -n kube-system -o wide|grep 'flannel'|grep ' {{ inventory_hostname }} '|awk '{print $3}'"
  register: pod_status
  until: pod_status.stdout == "Running"
  retries: 15
  delay: 8
  ignore_errors: true
                                                                                                                     

 

解决:

由于当前处于内核aarch64架构下,修改

/etc/ansible/roles/flannel/templates/kube-flannel.yaml.j2

beta.kubernetes.io/arch 为arm64

spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: beta.kubernetes.io/os
                    operator: In
                    values:
                      - linux
                  - key: beta.kubernetes.io/arch
                    operator: In
                    values:
                      - arm64

重新部署

最后

以上就是生动早晨为你收集整理的CentOS7 AltArch aarch64环境kubeasz flannel : 轮询等待flannel 运行,视下载镜像速度而定的全部内容,希望文章能够帮你解决CentOS7 AltArch aarch64环境kubeasz flannel : 轮询等待flannel 运行,视下载镜像速度而定所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部