博客内容跟网站相关吗个人和做网站方签合同模板
序
之前使用multipass装ubuntu,然后再用microk8s搭建k8s,这会直接用orbstack及kind在本地搭建k8s及istio
安装
orbstack
通过orbstack这个地址下载,主要是开销低,用来替代docker desktop
添加国内源
 ~/.orbstack/config/docker.json
{"registry-mirrors": ["http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com","https://registry.hub.docker.com"]
}
 
重启orbstack
安装go
brew install go
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
 
安装kind
go install sigs.k8s.io/kind@v0.20.0
export PATH=$HOME/go/bin:$PATH
kind create cluster
Creating cluster "kind" ...
⢎⡠ Ensuring node image (kindest/node:v1.27.3) 🖼
⢎⠁ Ensuring node image (kindest/node:v1.27.3) 🖼✓ Ensuring node image (kindest/node:v1.27.3) 🖼✓ Preparing nodes 📦✓ Writing configuration 📜
⠎⠁ Starting control-plane 🕹️
⠈⠁ Starting control-plane 🕹️
⠈⠱ Starting control-plane 🕹️
⠈⡱ Starting control-plane 🕹️✓ Starting control-plane 🕹️✓ Installing CNI 🔌✓ Installing StorageClass 💾
Set kubectl context to "kind-kind"
You can now use your cluster with:kubectl cluster-info --context kind-kindHave a nice day! 👋
 
使用
kubectl cluster-info --context kind-kind
Kubernetes control plane is running at https://127.0.0.1:51562
CoreDNS is running at https://127.0.0.1:51562/api/v1/namespaces/kube-system/services/kube-dns:dns/proxykubectl get pods -A
NAMESPACE            NAME                                         READY   STATUS    RESTARTS   AGE
kube-system          coredns-5d78c9869d-2rjmk                     1/1     Running   0          2m9s
kube-system          coredns-5d78c9869d-n72hp                     1/1     Running   0          2m9s
kube-system          etcd-kind-control-plane                      1/1     Running   0          2m23s
kube-system          kindnet-tjvh9                                1/1     Running   0          2m10s
kube-system          kube-apiserver-kind-control-plane            1/1     Running   0          2m24s
kube-system          kube-controller-manager-kind-control-plane   1/1     Running   0          2m23s
kube-system          kube-proxy-sjg2h                             1/1     Running   0          2m10s
kube-system          kube-scheduler-kind-control-plane            1/1     Running   0          2m23s
local-path-storage   local-path-provisioner-6bc4bddd6b-hpzrd      1/1     Running   0          2m9s
 
安装istio
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.2.5 sh -
 
或者下载https://github.com/istio/istio/releases/download/1.18.2/istio-1.18.2-osx-arm64.tar.gz
 解压,并将istio-1.18.2/bin添加到PATH中
istioctl install --set profile=demo -y
✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installed
✔ Ingress gateways installed
✔ Installation complete                                                                               Making this installation the default for injection and validation.kubectl get ns
NAME                 STATUS   AGE
default              Active   75m
istio-system         Active   104s
kube-node-lease      Active   75m
kube-public          Active   75m
kube-system          Active   75m
local-path-storage   Active   75m
➜  ~ kubectl get pods -n istio-system
NAME                                    READY   STATUS    RESTARTS   AGE
istio-egressgateway-75db994b58-jdztx    1/1     Running   0          61s
istio-ingressgateway-79bb75ddbb-965t8   1/1     Running   0          61s
istiod-68cb9f5cb6-jksg5                 1/1     Running   0          115s
 
小结
使用orbstack及kind在本地搭建k8s及istio显得极为轻量,首先orbstack比multipass起个machine轻量许多,其次kind比k3s,minikube更为轻量,虽然是单节点,但是特别适合学习和研究。
doc
- orbstack
 - kind
 - 安装istio
 
