| @@ -0,0 +1,56 @@ | |||
| 1 | + | # env setup | |
| 2 | + | ||
| 3 | + | ## k3s node setup | |
| 4 | + | ||
| 5 | + | ```bash | |
| 6 | + | POD_CIDR="10.42.0.0/16" | |
| 7 | + | API_SERVER_IP=10.201.24.235 | |
| 8 | + | API_SERVER_PORT=6443 | |
| 9 | + | cilium-cli install --set k8sServiceHost=${API_SERVER_IP} --set k8sServicePort=${API_SERVER_PORT} --set ipam.operator.clusterPoolIPv4PodCIDRList=$POD_CIDR --set kubeProxyReplacement=true --helm-set=operator.replicas=1 | |
| 10 | + | ``` | |
| 11 | + | ||
| 12 | + | ```bash | |
| 13 | + | helm upgrade --install vsphere-cpi vsphere-cpi/vsphere-cpi --namespace kube-system --set config.enabled=true --set config.vcenter="10.201.23.1" --set config.username='capv@vsphere.local' --set config.password="Giantswarm-2024" --set config.datacenter="giant-swarm" | |
| 14 | + | ``` | |
| 15 | + | ||
| 16 | + | ```bash | |
| 17 | + | kubectl patch node k3s-1-control-plane-hxf82 --type=json -p='[{"op":"remove","path":"/spec/taints"}]' | |
| 18 | + | ``` | |
| 19 | + | ||
| 20 | + | ## install fleet controller | |
| 21 | + | ||
| 22 | + | ref: https://fleet.rancher.io/how-tos-for-operators/installation#_configuration_for_multi_cluster | |
| 23 | + | ||
| 24 | + | get API server url for fleet controller cluster: | |
| 25 | + | ||
| 26 | + | ```bash | |
| 27 | + | API_SERVER_URL=$(kubectl --kubeconfig ../kubeconfigs/k3s-mc.kubeconfig config view -o json --raw | jq -r '.clusters[] | select(.name=="k3s-mc").cluster["server"]') | |
| 28 | + | ``` | |
| 29 | + | ||
| 30 | + | get API server CA bundle for fleet controller cluster: | |
| 31 | + | ||
| 32 | + | ```bash | |
| 33 | + | ||
| 34 | + | kubectl --kubeconfig /tmp/k3s-mc.kubeconfig config view -o json --raw | jq -r '.clusters[] | select(.name=="k3s-mc").cluster["certificate-authority-data"]' | base64 -d > ca.pem | |
| 35 | + | API_SERVER_CA="ca.pem" | |
| 36 | + | ``` | |
| 37 | + | ||
| 38 | + | ```bash | |
| 39 | + | helm -n cattle-fleet-system install --create-namespace --wait --set apiServerURL="$API_SERVER_URL" --set-file apiServerCA="$API_SERVER_CA" fleet fleet/fleet | |
| 40 | + | ``` | |
| 41 | + | ||
| 42 | + | ## install fleet agent | |
| 43 | + | ||
| 44 | + | ref: https://fleet.rancher.io/how-tos-for-operators/cluster-registration#_install_agent_for_a_predefined_cluster | |
| 45 | + | ||
| 46 | + | extract values from join token secret: | |
| 47 | + | ||
| 48 | + | ``` bash | |
| 49 | + | k view-secret k3s-test > extracted-values.yaml | |
| 50 | + | ``` | |
| 51 | + | ||
| 52 | + | install fleet-agent in the managed cluster: | |
| 53 | + | ||
| 54 | + | ```bash | |
| 55 | + | helm -n cattle-fleet-system install --create-namespace --wait --set clientID="k3s-test" --values extracted-values.yaml fleet-agent fleet/fleet-agent | |
| 56 | + | ``` | |
simon / rancher-fleet.md
Last active 3 months ago
simon revised this gist 3 months ago · 269e433
1 file changed, 56 insertions