一、安装k8s版本
export REGISTRY_MIRROR=https://registry.cn-hangzhou.aliyuncs.com
curl -sSL https://kuboard.cn/install-script/v1.30.x/install_kubelet.sh | sh -s 1.30.0
二、安装docker及minikube
useradd docker
passwd docker
密码也设置为docker
#创建docker组
sudo groupadd docker
#将您的用户添加到该docker组
sudo usermod -aG docker $USER
#在Linux上,运行以下命令来激活对组的更改
newgrp docker
#重启docker
systemctl restart docker
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
ls -lh /usr/local/bin/minikube
minikube version
minikube start --driver=docker --force 注意这一步耐心等待
minikube status
minikube kubectl -- get pods -A
#启动dashboard
minikube dashboard
三、配置快捷键
alias kcf='minikube kubectl -- create -f'
注意上面的“--”的位置,且不能省略。
四、创建资源
kubectl create -f nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:name: nginx-deployment
spec:selector:matchLabels:app: nginxreplicas: 2template:metadata:labels:app: nginxspec:containers:- name: nginximage: nginx:1.7.9ports:- containerPort: 80
参考:
https://minikube.sigs.k8s.io/docs/drivers/docker/
https://minikube.sigs.k8s.io/docs/start/?arch=%2Flinux%2Fx86-64%2Fstable%2Fbinary+download