minikube set up k8s in china with virtualbox driver in window
set up k8s in china with virtualbox driver in window (minikube)
minikube+virtualbox
## current version
- minikube 1.30.1
- docker 20.10.23
- Kubernetes 1.26.3
- virtualbox 7.0.8
ps:you can install them on windows like these:
```powershell
choco install virtualbox -y
scoop install minikube@1.30.1
# scoop install docker@20.10.23
# scoop install kubectl@1.26.3
```
## setup k8s (demo)
- [x] create and start ms and setup k8s
```powershell
minikube config set driver virtualbox
minikube start --memory 8912mb --cpus 8 `
--image-mirror-country=cn `
--host-only-cidr="192.168.59.1/24" `
--static-ip 192.168.59.100 `
--kubernetes-version='1.26.3'
```
```bash
minikube config set driver virtualbox
# minikube start --image-mirror-country=cn --host-only-cidr="192.168.59.1/24"
# $ip=minikube ip
minikube start --memory 8912mb --cpus 8\
--image-mirror-country=cn\
--host-only-cidr="192.168.59.1/24"\
--static-ip 192.168.59.100\
# --kubernetes-version='1.26.3'
# --cache-images=true \
# --insecure-registry='127.0.0.1:5000,192.168.59.100:32070' \
# --registry-mirror="https://registry.docker-cn.com,https://docker.mirrors.ustc.edu.cn" \
# --memory 2048mb --cpus 2
# --registry-mirror="https://registry.docker-cn.com,https://docker.mirrors.ustc.edu.cn"
# --insecure-registry='127.0.0.1:5000'
# --service-cluster-ip-range='10.10.0.0/24'
# --subnet='':
```
## next work
- [x] get pods (ps:`minikube kubectl -- get pods -A`)
- [x] get vm ip (ps:`minikube ip`)
- [x] install Kubernetes client kubectl tool to use kubectl easy for minikube
```powershell
scoop install kubectl@1.26.3
kubectl get pods -A
```
- [x] use dashborad (ps:`minikube addons enable dashborad`)
- [x] use helm 2.x (ps:`minikube addons enable helm;scoop install helm2` )
- [x] use helm 3.x (ps:`scoop install helm@3.12.2` )
......
- [ ] use docker registry
- [ ] use npm registry
- [ ] use github or gitlab
- [ ] use nginx-ingress
- [ ] use k8s to dev with vscode
## delete k8s
```powershell
minikube stop
# minikube delete --all
# clean all and delete ~/.minikube
# minikube delete --all --purge
# del minikube cache after uninstalling minikube
# del ~\.config\.minikube -Force -Recurse -ErrorAction SilentlyContinue
```
## refers
[minikube-offical-docs](https://minikube.sigs.k8s.io/)
[k8s.kubectl-usage](https://zhuanlan.zhihu.com/p/364994610)