- Install
kind
- Create cluster with config
- generate
config.yaml
- create kubernetes cluster
- generate
- Get kind cluster credential
- Set kind cluster credential
- (optional) Install kubectl
$ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
$ chmod +x ./kind
# Move it to your $PATH such as /usr/local/bin
# Ask your network administrator which IP you should use
$ sh gen_config.sh <IP> [nodePort_start] [nodePort_end] > config.yaml
The default range of NodePort
service will be lauched from port 30000~32767, you can adjust the port range on your own if needed.
$ kind create cluster --config=config.yaml
$ kind get kubeconfig > config_kind
Assume that you would like to access kind cluster remotely.
Then you have two options:
A>
Fill what you got from $ kind get kubeconfig
in your local ~/.kube/config.
B>
To save your time, follow steps in this repo
kubeconfig_merge. Then you just need to move the config_kind
, generated from previous step, under your local ~/.kube.
(local) $ scp host_kind:/path/to/config_kind ~/.kube/
(local) $ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# Move it to your $PATH such as /usr/local/bin
source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first.
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.
alias k=kubectl
complete -F __start_kubectl k
Feel free to contact me through email in english or chinese.