Kind(Kubernetes in Docker)是一个用于本地快速搭建 Kubernetes 集群的工具,它使用 Docker 容器来模拟 Kubernetes 集群中的节点。
在 Kind 中管理镜像主要有以下两种方式:
- 使用本地镜像
在 Kind 中使用本地已经存在的镜像,可以通过使用 --image
参数来指定某个镜像作为节点的镜像。例如:
kind create cluster --name my-cluster --image my-image:latest
- 使用镜像仓库
在 Kind 中使用镜像仓库来获取需要的镜像,可以通过编写一个 YAML 文件来指定需要使用的镜像和镜像仓库信息。例如:
# kind.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: my-registry/my-custom-node-image:v1.18.4
- role: worker
image: my-registry/my-custom-node-image:v1.18.4
然后使用以下命令启动集群:
kind create cluster --config kind.yaml
以上就是在 Kind 中管理镜像的两种方式。