zoukankan      html  css  js  c++  java
  • k8s-常见错误

    一 网络错误

    报错提示:network: failed to set bridge addr: "cni0" already has an IP address differe

    解决办法:

    ip link set cni0 down
    ip link delete cni0
    

     

    二命名空间不能删除

    参考:https://www.cnblogs.com/douh/p/12487577.html

     

    1 先运行 kubectl get ns ingress-nginx -o json > rdbms.json

    其中 ingress-nginx是你要删除的命名空间,然后打开rdbms.json,删除其中的spec字段

     

    2 然后新开一个窗口运行kubectl proxy跑一个API代理在本地的8081端口

      # kubectl proxy --port=8081

     

    3 执行命令删除

     

    curl -k -H "Content-Type: application/json" -X PUT --data-binary @rdbms.json http://127.0.0.1:8081/api/v1/namespaces/ingress-nginx/finalize

    其中json文件和命名空间要和第一条命令一致。

     

    三 解决国内无法拉取k8s镜像的问题

     

     

    参考 https://www.jianshu.com/p/d42ef0eff63f

     

    查看kubeadm config所需的镜像

     

    $ kubeadm config images list
    
    k8s.gcr.io/kube-apiserver:v1.13.1
    k8s.gcr.io/kube-controller-manager:v1.13.1
    k8s.gcr.io/kube-scheduler:v1.13.1
    k8s.gcr.io/kube-proxy:v1.13.1
    k8s.gcr.io/pause:3.1
    k8s.gcr.io/etcd:3.2.24
    k8s.gcr.io/coredns:1.2.6
    

    1:中转

    首先从Kubernetes国内Docker镜像镜像,然后修改镜像的tag

    sudo docker tag registry.cn-beijing.aliyuncs.com/imcto/kube-controller-manager:v1.13.1 k8s.gcr.io/kube-controller-manager:v1.13.1
    sudo docker tag registry.cn-beijing.aliyuncs.com/imcto/kube-apiserver:v1.13.1 k8s.gcr.io/kube-apiserver:v1.13.1
    sudo docker tag registry.cn-beijing.aliyuncs.com/imcto/kube-proxy:v1.13.1 k8s.gcr.io/kube-proxy:v1.13.1
    sudo docker tag registry.cn-beijing.aliyuncs.com/imcto/kube-scheduler:v1.13.1 k8s.gcr.io/kube-scheduler:v1.13.1
    sudo docker tag registry.cn-beijing.aliyuncs.com/imcto/etcd:3.2.24 k8s.gcr.io/etcd:3.2.24
    sudo docker tag registry.cn-beijing.aliyuncs.com/imcto/pause:3.1 k8s.gcr.io/pause:3.1
    sudo docker tag registry.cn-beijing.aliyuncs.com/imcto/coredns:1.2.6 k8s.gcr.io/coredns:1.2.6
    

    2:修改配置kubeadm.conf

    使用kubeadm配置文件,通过在配置文件中指定docker仓库地址,便于内网快速部署。

    生成配置文件

     

    kubeadm config print init-defaults ClusterConfiguration >kubeadm.conf
    

     

    修改kubeadm.conf

    再次查看kubeadm config所需的镜像

    $ kubeadm config images list --config kubeadm.conf
    registry.cn-beijing.aliyuncs.com/imcto/kube-apiserver:v1.13.1
    registry.cn-beijing.aliyuncs.com/imcto/kube-controller-manager:v1.13.1
    registry.cn-beijing.aliyuncs.com/imcto/kube-scheduler:v1.13.1
    registry.cn-beijing.aliyuncs.com/imcto/kube-proxy:v1.13.1
    registry.cn-beijing.aliyuncs.com/imcto/pause:3.1
    registry.cn-beijing.aliyuncs.com/imcto/etcd:3.2.24
    registry.cn-beijing.aliyuncs.com/imcto/coredns:1.2.6
    

    拉取镜像并初始化

    kubeadm config images pull --config kubeadm.conf
    kubeadm init --config kubeadm.conf
    

     

  • 相关阅读:
    SCCM 补丁更新 失误排错一例
    Oracle 远程连接 DB配置 连接命令
    反向代理服务器
    用JMF播放音频 例子
    HTML css兼容
    Java国际化
    JBPM 之介绍,使用
    Nginx内核优化引用
    Nginx 学习
    局域网访问VMware虚拟机中的Ubuntu
  • 原文地址:https://www.cnblogs.com/huningfei/p/12705355.html
Copyright © 2011-2022 走看看