发表更新2 分钟读完 (大约255个字)
2021-08-23-linux 安装与卸载 miniKube
- 确保禁止掉 swap 分区
1 2 3 4
| sudo swapoff -a
#修改/etc/fstab,注释掉swap那行,持久化生效 sudo vi /etc/fstab
|
- 安装 kubelet kubeadm kubectl
1 2 3 4 5 6 7
| apt-get update && apt-get install -y apt-transport-https curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add - cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main EOF apt-get update apt-get install -y kubelet kubeadm kubectl
|
- 安装 minikube
1 2 3 4 5 6 7 8 9
| sudo cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF
|
参考文档
1 2
| curl -Lo minikube https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.20.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
|
- 运行
- 提供外网访问
1 2 3
| nohup kubectl proxy --port=[需要暴露的端口号] --address='[服务器IP]' --accept-hosts='^[外部访问服务器的IP]$' >/dev/null 2>&1&
nohup kubectl proxy --port=34664 --address='192.168.50.129' --accept-hosts='^192.168.50.7$' >/dev/null 2>&1&
|
- 卸载
1 2 3 4 5 6
| ## 停止运行 minikube stop ## 执行卸载命令 minikube delete ## 删除 ~/.minikube 目录缓存的文件 rm -rf ~/.minikube
|