Kubernetes-On-MacOS-minikube
安装软件
1 2 3 4
| brew install docker brew install virtualbox brew install kubectl brew install minikube
|
minikube 命令
start
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
minikube config set driver virtualbox
minikube start
minikube start --v=0 --kubernetes-version v1.20.7 --cpus 4 --memory=8192 --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers --driver=virtualbox
--v 日志等级 0 INFO level logs 1 WARNING level logs 2 ERROR level logs 3 libmachine logging 7 libmachine --debug level logging --kubernetes-version 指定版本 --cpus 4 --memory=8192 指定资源 --image-repository 指定镜像代理 --driver=virtualbox 指定 driver, 如果设置过默认 driver 这个可以忽略
|
dashboard
1 2 3 4 5 6
|
minikube dashboard
minikube dashboard --url
|
addons
1 2 3 4 5 6 7
|
minikube addons enable ingress
minikube addons disable ingress
minikube addons list
|
service
1 2
| minikube service hello-node
|
stop delete
1 2 3 4
| minikube stop
minikube delete
|
kubectl 命令
deployment
1 2 3 4
| kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4
kubectl get deployments
|
event
configuration
pods
1 2 3 4 5 6 7 8 9 10
|
kubectl get pods
kubectl get pods --all-namespaces -o wide
kubectl get pods -n kube-system -o wide
kubectl describe pod PodName
|
services
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| kubectl get pod,svc -n kube-system
kubectl get services --all-namespaces
kubectl expose deployment hello-node --type=LoadBalancer --port=8080
kubectl get services --all-namespaces
minikube service hello-node
|
cleanup
1 2 3
| kubectl delete service hello-node kubectl delete deployment hello-node
|
参考资料
在MacOS上安装kubernetes
在MAC上安装K8S (kubernets) for Docker Desktop
手摸手教你从开发到部署(CI/CD)GO微服务系列
minikube docs
k8s tutorials Hello Minikube