https://github.com/kubernetes-sigs/kind/
https://github.com/kubernetes-sigs/kind/releases/
cd /usr/local/bin
wget https://github.com/kubernetes-sigs/kind/releases/download/0.2.1/kind-linux-amd64
...
wget https://github.com/kubernetes-sigs/kind/releases/download/v0.6.1/kind-linux-amd64
mv kind-linux-amd64 kind
chmod +x /path-to-kind/kind
wget https://raw.githubusercontent.com/kubernetes-sigs/kind/master/site/content/docs/user/kind-example-config.yaml
kind create cluster --config kind-example-config.yaml
https://kind.sigs.k8s.io/docs/user/quick-start/#configuring-your-kind-cluster
wget https://raw.githubusercontent.com/latermonk/kind-for-cka/master/config/multi-node-cluster.conf
kind create cluster --config config-file
where config-file:
# three node (two workers) cluster config
kind: Config
apiVersion: kind.sigs.k8s.io/v1alpha2
nodes:
- role: control-plane
- role: worker
replicas: 2
yum -y install zsh
chsh -s /bin/zsh
yum install -y git
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
or
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
yum -y install bash-completion
install epel-release if needed !!!
yum -y install epel-release
yum install -y golang
go version
mkdir $HOME/go
vim ~/.bashrc
#vim ~/.zshrc
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
. $HOME/.bashrc
go env
cd /etc/yum.repos.d
wget https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
mkdir /etc/docker
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
systemctl restart docker && systemctl enable docker
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
yum install -y kubectl
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
安装kubectl
yum -y install kubectl
go get sigs.k8s.io/kind
kind create cluster
找不到kind:
错误方法
添加
export PATH=$PATH:/root/go/bin
到.bashrc
正确方法: 在配置go环境变量的时候就设置好路径$PATH
export GOPATH=/root/go
export PATH=$PATH:$GOPATH/bin
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
source <(kubectl completion zsh)
edit .zshrc and add the following lines
if [ $commands[kubectl] ]; then
source <(kubectl completion zsh)
fi
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
kubectl cluster-info
创建
删除
...
#go env setup
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
#kubectl completion
if [ $commands[kubectl] ]; then
source <(kubectl completion zsh)
fi
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
#kubeclt alias
alias k=kubectl
参考: https://github.com/kubernetes-sigs/kind/tree/master/docs/user
reference: https://github.com/kubernetes-sigs/kind