使用kind在mac本地搭建k8s及istio

之前使用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-kind

Have 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/proxy

kubectl 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值