kind安装官方文档:https://kind.sigs.k8s.io/docs/user/quick-start/#installing-with-a-package-manager kind配置文件说明: https://kind.sigs.k8s.io/docs/user/configuration/ kind git: https://github.com/kubernetes-sigs/kind k8s 官方
kind介绍kind安装官方文档:https://kind.sigs.k8s.io/docs/user/quick-start/#installing-with-a-package-manager
kind配置文件说明: https://kind.sigs.k8s.io/docs/user/configuration/
kind git: https://github.com/kubernetes-sigs/kind
k8s 官方文档:https://kubernetes.io/docs/tasks/tools/
k8s 单机安装的方式有很多,如:
- 通过docker desktop桌面一键部署
- 通过minikube部署一个单节点的k8s集群
- 通过kubeadm部署并定理k8s集群工具
- 通过kind部署一个k8s集群,支持多节点, 需要docker
Kind 是 Kubernetes In Docker 的缩写,顾名思义是使用 Docker 容器作为 Node 并将 Kubernetes 部署至其中的一个工具。其实内部也是kubeadm来管理集群的。
kind安装 二进制方式安装这里选择二进制方式安装,so fast and so easy ~
# for Intel Macs
[ $(uname -m) = x86_64 ]&& curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.13.0/kind-darwin-amd64
# for M1 / ARM Macs
[ $(uname -m) = arm64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.13.0/kind-darwin-arm64
chmod +x ./kind
mv ./kind /some-dir-in-your-PATH/kind
# 我的执行 mv ./kind ~/devTools/k8s/kind
# 为kind配置环境变量
vim ~/.zprofile
export PATH=${PATH}:~/devTools/k8s
$ kind version
kind v0.13.0 go1.18 darwin/arm64
kind命令
先查看一下kind命令,支持哪些操作
$ ./kind --help
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, higher value produces more output
--version version for kind
Use "kind [command] --help" for more information about a command.
kind create cluster 命令
$ ./kind create cluster --help
Creates a local Kubernetes cluster using Docker container 'nodes'
Usage:
kind create cluster [flags]
Flags:
--config string path to a kind config file
-h, --help help for cluster
--image string node docker image to use for booting the cluster
--kubeconfig string sets kubeconfig path instead of $KUBECONFIG or $HOME/.kube/config
--name string cluster name, overrides KIND_CLUSTER_NAME, config (default kind)
--retain retain nodes for debugging when cluster creation fails
--wait duration wait for control plane node to be ready (default 0s)
Global Flags:
--loglevel string DEPRECATED: see -v instead
-q, --quiet silence all stderr output
-v, --verbosity int32 info log verbosity, higher value produces more output
创建默认单节点集群
# 创建一个默认集群并指定集群名称,名称需要满足规则: `^[a-z0-9.-]+$`
$ ./kind create cluster --name my-test-cluster
Creating cluster "my-test-cluster" ...
✓ Ensuring node image (kindest/node:v1.24.0)