新增 Service:k3d
29
Service%EF%BC%9Ak3d.md
Normal file
29
Service%EF%BC%9Ak3d.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# 安裝 kubectl & k3d
|
||||
|
||||
```bash
|
||||
apt update \
|
||||
&& apt install -y curl \
|
||||
&& wget "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -O /usr/local/bin/kubectl \
|
||||
&& chmod +x /usr/local/bin/kubectl \
|
||||
&& curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
|
||||
```
|
||||
|
||||
# 建立 1 個伺服器 2 個代理
|
||||
|
||||
```bash
|
||||
k3d cluster create ct \
|
||||
--servers 1 \
|
||||
--agents 2 \
|
||||
--port 80:80@loadbalancer \
|
||||
--port 443:443@loadbalancer \
|
||||
--k3s-arg '--kubelet-arg=feature-gates=KubeletInUserNamespace=true@server:*' \
|
||||
--k3s-arg '--kubelet-arg=feature-gates=KubeletInUserNamespace=true@agent:*' \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
--registry-create k3d-ct-registry:5000
|
||||
```
|
||||
|
||||
# 驗證節點
|
||||
|
||||
```bash
|
||||
kubectl get nodes
|
||||
```
|
||||
Reference in New Issue
Block a user