【k8s】轻量级搭建k8s集群的工具Kind(1)

Kind 是什么? 这里就不复读了,大家可以直接查看官方文档,下面是我使用 Kind 碰到的问题,和解决的过程。

# linux环境下下载
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.10.0/kind-linux-amd64
chmod +x ./kind

查看一下 kind 的 help 文档。

➜  k8s ./kind
kind creates and manages local Kubernetes clusters using Docker container 'nodes'

Usage:
  kind [command]

Available Commands:
  build       Build one of [node-image]
  completion  Output shell completion code for the specified shell (bash, zsh or fish)
  create      Creates one of [cluster]
  delete      Deletes one of [cluster]
  export      Exports one of [kubeconfig, logs]
  get         Gets one of [clusters, nodes, kubeconfig]
  help        Help about any command
  load        Loads images into nodes
  version     Prints the kind CLI version

Flags:
  -h, --help              help for kind
      --loglevel string   DEPRECATED: see -v instead
  -q, --quiet             silence all stderr output
  -v, --verbosity int32   info log verbosity
      --version           version for kind

Use "kind [command] --help" for more information about a command.

重点还是在几个 command 上。

现在通过 create 创建集群,看到此时卡在这里,都不知道在发生什么,确实有点懵逼,我们考虑下次创建集群的时候通过调整 log 等级,多打一点日志出来。
在这里插入图片描述
OK,等了一会还是报错了。
在这里插入图片描述
又报错了。

Command Output: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

这个倒是不陌生了,就是 docker hub 给你请求做的限制,运营过镜像仓库的人都懂,每个人都去拉,很容易拉爆,尤其是现在 k8s 这么流行了,hub 崩了,那是大家都难受,运维过仓库的人必须懂…
在这里插入图片描述
超出 limit 没关系,不想付钱,就等一会呗,可是还是报错了,你们看,我根分区快要爆了…
在这里插入图片描述
还是有其他问题,但是只要有报错信息,就不是问题!

Creating cluster "kind" ...
ERROR: failed to create cluster: failed to ensure docker network: command "docker network create -d=bridge -o com.docker.network.bridge.enable_ip_masquerade=true --ipv6 --subnet fc00:f853:ccd:e793::/64 kind" failed with error: exit status 1
Command Output: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

在这里插入图片描述
根据这个报错信息,可以知道是 Kind 再通过 Docker 创建网络的时候出错了,可以找到下面的代码。ipv6 支持一般,可能会有很多问题,所以我们看看是否有配置可以配成成默认的方式,也就是创建 ipv4 类型的网络。
在这里插入图片描述
当然,走读代码之后发现,Kind 在通过 Docker 创建网络的时候,确实会先走 --ipv6,那么这里应该也是没毛病的,那执行一下 docker network create -d=bridge -o com.docker.network.bridge.enable_ip_masquerade=true --ipv6 --subnet fc00:f853:ccd:e793::/64 kind 这个命令,结果就是返回 Error Response,这个跟 Kind 调用是没有差别。

这个问题原来通过谷歌检索,十有八九是说 docker 默认支持 30 个不同的自定义 bridge 网络(不信你试试),但是我在自己的开发机上 docker network ls 之后发现也才几个 bridge 网络而已,所以显然问题不在这里,当然了这个问题就不深究了,解决的方法不一定就是说 bridge 网络超过限制了,可能是静态路由的问题,此时可通过 ip route del 172.16.0.0/12 来删除,然后 Docker 就可以创建网络成功了。

问题解决了,集群也创建成功了。
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值