https://www.cnblogs.com/pack27/p/12202687.html
https://www.jianshu.com/p/18441c7434a6
一,安装docker
#Step 2:安装必要包 sudo yum install -y yum-utils device-mapper-persistent-data lvm2 # Step 2: 添加软件源信息 sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # Step 3: 更新并安装Docker-CE sudo yum makecache fast sudo yum -y install docker-ce # Step 4: 开启Docker服务 sudo service docker start systemctl enable docker
二,安装kubectl
下载二进制包https://github.com/kubernetes/kubernetes/releases
解压 后把可执行程序kubectl移动至/usr/local/bin
三,安装minikube
下载
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
安装
mv minikube-linux-amd64 minikube chmox +x minikube mv minikube /usr/local/bin/ #安装需要设置成国内源 minikube start --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers'
查看
# kubectl get cs,node NAME STATUS MESSAGE ERROR componentstatus/scheduler Healthy ok componentstatus/controller-manager Healthy ok componentstatus/etcd-0 Healthy {"health":"true"} NAME STATUS ROLES AGE VERSION node/k8s-minikube Ready master 17m v1.17.3
创建一个测试用例
kubectl run nginx --image=nginx --port=80 kubectl expose deployment nginx --port=80 --target-port=80 --type=NodePort
查看
# kubectl get node,svc NAME STATUS ROLES AGE VERSION node/k8s-minikube Ready master 19m v1.17.3 NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19m service/nginx NodePort 10.106.214.5 <none> 80:30807/TCP 15m
能使用node加NodePort端口访问即可,单机minikube搭建完成,可由于开发及测试。