@@ -69,11 +69,18 @@ stringData:
69
69
EOF
70
70
```
71
71
72
- To create an example cluster:
72
+ Generate a cluster definition from the file specified in the ` --from ` flag
73
+ and apply the generated resource to actually create the cluster in the API.
74
+ For example, the following command will create a Docker cluster with Cilium CNI applied via the Helm addon provider:
73
75
74
76
``` shell
75
- clusterctl generate cluster docker-quick-start-helm-addon-cilium \
76
- --from examples/capi-quick-start/docker-cluster-cilium-helm-addon.yaml \
77
+ export CLUSTER_NAME=docker-cluster-cilium-helm-addon
78
+ export CLUSTER_FILE=examples/capi-quick-start/docker-cluster-cilium-helm-addon.yaml
79
+ ```
80
+
81
+ ``` shell
82
+ clusterctl generate cluster ${CLUSTER_NAME} \
83
+ --from ${CLUSTER_FILE} \
77
84
--kubernetes-version v1.29.1 \
78
85
--worker-machine-count 1 | \
79
86
kubectl apply --server-side -f -
@@ -82,36 +89,36 @@ clusterctl generate cluster docker-quick-start-helm-addon-cilium \
82
89
Wait until control plane is ready:
83
90
84
91
``` shell
85
- kubectl wait clusters/docker-quick-start-helm-addon-cilium --for=condition=ControlPlaneInitialized --timeout=5m
92
+ kubectl wait clusters/${CLUSTER_NAME} --for=condition=ControlPlaneInitialized --timeout=5m
86
93
```
87
94
88
95
To get the kubeconfig for the new cluster, run:
89
96
90
97
``` shell
91
- clusterctl get kubeconfig docker-quick-start-helm-addon-cilium > docker-kubeconfig
98
+ clusterctl get kubeconfig ${CLUSTER_NAME} > ${CLUSTER_NAME} .conf
92
99
```
93
100
94
101
If you are not on Linux, you will also need to fix the generated kubeconfig's ` server ` , run:
95
102
96
103
``` shell
97
- kubectl config set-cluster docker-quick-start-helm-addon-cilium \
98
- --kubeconfig docker-kubeconfig \
99
- --server=https://$( docker container port docker-quick-start-helm-addon-cilium -lb 6443/tcp)
104
+ kubectl config set-cluster ${CLUSTER_NAME} \
105
+ --kubeconfig ${CLUSTER_NAME} .conf \
106
+ --server=https://$( docker container port ${CLUSTER_NAME} -lb 6443/tcp)
100
107
```
101
108
102
109
Wait until all nodes are ready (this indicates that CNI has been deployed successfully):
103
110
104
111
``` shell
105
- kubectl --kubeconfig docker-kubeconfig wait nodes --all --for=condition=Ready --timeout=5m
112
+ kubectl --kubeconfig ${CLUSTER_NAME} .conf wait nodes --all --for=condition=Ready --timeout=5m
106
113
```
107
114
108
115
Show that Cilium is running successfully on the workload cluster:
109
116
110
117
``` shell
111
- kubectl --kubeconfig docker-kubeconfig get daemonsets -n kube-system cilium
118
+ kubectl --kubeconfig ${CLUSTER_NAME} .conf get daemonsets -n kube-system cilium
112
119
```
113
120
114
- Deploy kube-vip to provide service load-balancer:
121
+ Deploy kube-vip to provide service load-balancer functionality for Docker clusters :
115
122
116
123
``` shell
117
124
helm repo add --force-update kube-vip https://kube-vip.github.io/helm-charts
@@ -122,29 +129,29 @@ kubectl create configmap \
122
129
--namespace kube-system kubevip \
123
130
--from-literal " range-global=${kind_subnet_prefix} 100.0-${kind_subnet_prefix} 100.20" \
124
131
--dry-run=client -oyaml |
125
- kubectl --kubeconfig docker-kubeconfig apply --server-side -n kube-system -f -
132
+ kubectl --kubeconfig ${CLUSTER_NAME} .conf apply --server-side -n kube-system -f -
126
133
127
134
helm upgrade kube-vip-cloud-provider kube-vip/kube-vip-cloud-provider --version 0.2.2 \
128
135
--install \
129
136
--wait --wait-for-jobs \
130
137
--namespace kube-system \
131
- --kubeconfig docker-kubeconfig \
138
+ --kubeconfig ${CLUSTER_NAME} .conf \
132
139
--set-string=image.tag=v0.0.6
133
140
134
141
helm upgrade kube-vip kube-vip/kube-vip --version 0.4.2 \
135
142
--install \
136
143
--wait --wait-for-jobs \
137
144
--namespace kube-system \
138
- --kubeconfig docker-kubeconfig \
145
+ --kubeconfig ${CLUSTER_NAME} .conf \
139
146
--set-string=image.tag=v0.6.0
140
147
```
141
148
142
149
Deploy traefik as a LB service:
143
150
144
151
``` shell
145
- helm --kubeconfig docker-kubeconfig repo add traefik https://helm.traefik.io/traefik
152
+ helm --kubeconfig ${CLUSTER_NAME} .conf repo add traefik https://helm.traefik.io/traefik
146
153
helm repo update & > /dev/null
147
- helm --kubeconfig docker-kubeconfig upgrade --install traefik traefik/traefik \
154
+ helm --kubeconfig ${CLUSTER_NAME} .conf upgrade --install traefik traefik/traefik \
148
155
--version v10.9.1 \
149
156
--wait --wait-for-jobs \
150
157
--set ports.web.hostPort=80 \
@@ -155,13 +162,13 @@ helm --kubeconfig docker-kubeconfig upgrade --install traefik traefik/traefik \
155
162
Watch for traefik LB service to get an external address:
156
163
157
164
``` shell
158
- watch -n 0.5 kubectl --kubeconfig docker-kubeconfig get service/traefik
165
+ watch -n 0.5 kubectl --kubeconfig ${CLUSTER_NAME} .conf get service/traefik
159
166
```
160
167
161
168
To delete the workload cluster, run:
162
169
163
170
``` shell
164
- kubectl delete cluster docker-quick-start-helm-addon-cilium
171
+ kubectl delete cluster ${CLUSTER_NAME}
165
172
```
166
173
167
174
Notice that the traefik service is deleted before the cluster is actually finally deleted.
0 commit comments