minikube windows hyperx填坑記

TT.Net發表於2019-03-29

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

相關文章