使用 Minikube 部署 Kubernetes 集群
环境确认
# 确认宿主机是否支持虚拟化,支持的话下面命令有内容输出
egrep --color 'vmx|svm' /proc/cpuinfo
单机部署
Installing minikube
Install kubectl
直接二进制安装最新版本
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
# Move the binary in to your PATH.
sudo mv ./kubectl /usr/local/bin/kubectl
# Test to ensure the version you installed is up-to-date:
kubectl version
# 输出信息如下
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:18:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Install a Hypervisor
# 安装KVM,参考链接:https://www.cyberciti.biz/faq/installing-kvm-on-ubuntu-16-04-lts-server/
sudo apt-get install qemu-kvm libvirt-bin virtinst bridge-utils cpu-checker
# 确认安装
➜ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
二进制安装 minikube
# download
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& chmod +x minikube
# install
sudo install minikube /usr/local/bin
# confirm
➜ minikube version
minikube version: v1.2.0
进入 minikube 虚拟机
minikube ssh -p zzz-cluster
# 打开浏览器载入 dashboard
minikube dashboard
minikube 创建集群
$ minikube start -p zzz-cluster --vm-driver kvm2
😄 minikube v1.2.0 on linux (amd64)
🔥 Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
🐳 Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6
💾 Downloading kubelet v1.15.0
💾 Downloading kubeadm v1.15.0
🚜 Pulling images ...
🚀 Launching Kubernetes ...
⌛ Verifying: apiserver proxy etcd scheduler controller dns
🏄 Done! kubectl is now configured to use "zzz-cluster"
启动集群
# 启动 cluster 且输出详细日志
minikube start -p zzz-cluster --vm-driver kvm2 –-v=9
关闭集群
minikube stop -p zzz-cluster
删除集群
minikube delete -p zzz-cluster
本文由 zealzhangz 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为:
2020/01/06 20:35