minikube windows hyperx填坑记

Posted francis67

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了minikube windows hyperx填坑记相关的知识,希望对你有一定的参考价值。

minikube windows hyperx填坑记

安装了一天半,还是没行,先放弃

开始

minikube start --vm-driver=hyperv --hyperv-virtual-switch=k8svswitch --cpus=4 --memory=4096
--docker-env HTTP_PROXY=http://192.168.31.77:1080 --docker-env HTTPS_PROXY=http://192.168.31.77:1080 --docker-env NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.1/24 --alsologtostderr

其中需要按SSR翻QIANG代理情况改写内部IP

## 注意!!!!千万不要加这个,国内好多博主加了这条,神坑了半天
 --registry-mirror=https://registry.docker-cn.com 
systemctl enable docker.service
kubeadm config images pull

下载需要的镜像

kubeadm config images list |sed -e 's/^/docker pull /g' -e 's#k8s.gcr.io#docker.io/mirrorgooglecontainers#g' |sh -x

上面下不了的手动

docker pull coredns/coredns:1.3.1 
docker pull mirrorgooglecontainers/kube-addon-manager:v9.0 
docker pull mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.1 
docker pull hawsers/storage-provisioner:v1.8.1

TAG

重命名镜像

docker images |grep mirrorgooglecontainers |awk '{print "docker tag ",$1":"$2,$1":"$2}' |sed -e 's#mirrorgooglecontainers#k8s.gcr.io#2' |sh -x  

手动

docker tag coredns/coredns:1.3.1 k8s.gcr.io/coredns:1.3.1
docker tag mirrorgooglecontainers/kube-addon-manager:v9.0 k8s.gcr.io/kube-addon-manager:v9.0
docker tag mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.1 k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
docker tag hawsers/storage-provisioner:v1.8.1 gcr.io/k8s-minikube/storage-provisioner:v1.8.1

删除

删除mirrorgooglecontainers镜像

docker images |grep mirrorgooglecontainers |awk '{print "docker rmi ", $1":"$2}' |sh -x 

手动

docker rmi coredns/coredns:1.3.1
docker rmi mirrorgooglecontainers/kube-addon-manager:v9.0
docker rmi mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.1
docker rmi hawsers/storage-provisioner:v1.8.1 
kubectl get pods
minikube service kube-nginx --url

minikube logs
minikube dashboard

Docker 基本操作

minikube service kube-nginx --url

To delete all containers including its volumes use,

docker rm -vf $(docker ps -a -q)

To delete all the images

docker rmi -f $(docker images -a -q)

Use this to delete everything:

docker system prune -a --volumes

3.3 启动一个服务

创建一个 Nginx Pod 服务

$ kubectl run kube-nginx --image=nginx:latest --port=80 
deployment.apps/kube-nginx created

通过 NodePort 暴露服务

$ kubectl expose deployment kube-nginx --type=NodePort 
service/kube-nginx exposed

检查 Pod 状态

$ kubectl get pods 
NAME                                        READY       STATUS      RESTARTS     AGE 
kube-nginx-6d8f6d45-rwz2g        1/1          Running                 0       1d
docker logs --tail 200 c8b9a4c46345
kubectl get pods --all-namespaces
kubectl get svc

以上是关于minikube windows hyperx填坑记的主要内容,如果未能解决你的问题,请参考以下文章

访问 minikube 仪表板 - (Ubuntu20.04 服务器)VM 运行在带有 VirtualBox 6.1 的 Windows 10 主机上

minikube部署k8s

minikube部署k8s

minikube部署k8s

minikube部署k8s

使用Minikube运行一个本地单节点Kubernetes集群