Install kubectl binary with curl on Linux
https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
minikube
https://minikube.sigs.k8s.io/docs/start/
遇到的问题:
X Exiting due to MK_USAGE: 'none' driver does not support 'minikube ssh' command
解决:
adduser alpha
usermod -aG docker alpha && newgrp docker
su - alpha
minikube start --driver=docker
kubectl get pods
ImagePullBackOff
The status ImagePullBackOff
means that a Pod couldn’t start because Kubernetes could not pull a container image. The ‘BackOff’ part indicates that Kubernetes will keep trying to pull the image, with an increasing back-off delay.
原因:! minikube was unable to download gcr.io/k8s-minikube/kicbase:v0.0.27, but successfully downloaded docker.io/kicbase/stable:v0.0.27 as a fallback image
,应该是镜像拉取不下来。
解决:
minikube start --image-mirror-country cn --iso-url=https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/iso/minikube-v1.5.0.iso --registry-mirror=https://pe3ox7bd.mirror.aliyuncs.com --driver=docker --memory=2048
Create a sample deployment and expose it on port 8080:
kubectl create deployment hello-minikube --image=registry.cn-hangzhou.aliyuncs.com/google_containers/echoserver:1.4 kubectl expose deployment hello-minikube --type=NodePort --port=8080
访问:NodePort
kubectl get svc
minikube service mysvc, url浏览器访问
执行
minikube tunnel
报错:
errors:
minikube: no errors
router: no errors
loadbalancer emulator: no errors
解决:
Please keep in mind that minikube tunnel
session must be opened whole the time otherwise your LB will stop getting IP address.
kubectl get services balanced
链接:https://stackoverflow.com/questions/58790433/cannot-export-a-ip-in-minikube-and-haproxy-loadbalancer
参考链接:
https://zhuanlan.zhihu.com/p/241030384
https://v1-18.docs.kubernetes.io/zh/docs/setup/learning-environment/minikube/
https://stackoverflow.com/questions/52698748/connection-refused-on-pushing-a-docker-image
https://stackoverflow.com/questions/68984450/minikube-why-the-docker-driver-should-not-be-used-with-root-privileges
https://www.ithands-on.com/2020/12/minikube-101-error-exiting-due-to.html