@@ -128,6 +128,24 @@ $ cmk create loadbalancerrule algorithm=roundrobin name="k8s-api" privateport=64
128128}
129129```
130130
131+ > Note 2: For this example an additional "loadbalancerrule" is needed to enable the communication between ` talosctl ` and the VM.
132+
133+ ``` bash
134+ $ cmk create loadbalancerrule algorithm=roundrobin name=" talos-api" privateport=50000 publicport=50000 openfirewall=true publicipid=${PUBLIC_IPADDRESS_ID} cidrlist=0.0.0.0/0
135+ {
136+ " loadbalancer" : {
137+ ...
138+ " name" : " talos-api" ,
139+ " networkid" : " 143ed8f1-3cc5-4ba2-8717-457ad993cf25" ,
140+ " privateport" : " 50000" ,
141+ " publicip" : " 10.0.0.102" ,
142+ " publicipid" : " 1901d946-3797-48aa-a113-8fb730b0770a" ,
143+ " publicport" : " 50000" ,
144+ ...
145+ }
146+ }
147+ ```
148+
131149### Create the Talos Configuration Files
132150
133151Finally it's time to generate the Talos configuration files, using the Public IP address assigned to the loadbalancer.
@@ -147,8 +165,10 @@ Make any adjustments to the `controlplane.yaml` and/or `worker.yaml` as you like
147165
148166Next we will create the actual VM and supply the ` controlplane.yaml ` as base64 encoded ` userdata ` .
149167
168+ > Note: Depending on the underlying OS, you would need to change the right newline character to remove (e.g., for macOS ` ... | tr -d '\n\r' `
169+
150170``` bash
151- $ cmk deploy virtualmachine zoneid=${ZONE_ID} templateid=${IMAGE_ID} serviceofferingid=${SERVICEOFFERING_ID} networkIds=${NETWORK_ID} name=talosdemo usersdata =$( base64 controlplane.yaml | tr -d ' \n' )
171+ $ cmk deploy virtualmachine zoneid=${ZONE_ID} templateid=${IMAGE_ID} serviceofferingid=${SERVICEOFFERING_ID} networkIds=${NETWORK_ID} name=talosdemo userdata =$( base64 controlplane.yaml | tr -d ' \n' )
152172{
153173 " virtualmachine" : {
154174 " account" : " admin" ,
@@ -172,26 +192,28 @@ $ cmk list virtualmachines | jq -r '.virtualmachine[] | [.id, .ipaddress, .name]
172192545099fc-ec2d-4f32-915d-b0c821cfb634 10.1.1.97 srv04
173193d37aeca4-7d1f-45cd-9a4d-97fdbf535aa1 10.1.1.243 talosdemo
174194$ export VM_ID=d37aeca4-7d1f-45cd-9a4d-97fdbf535aa1
175- $ export VM_IP=10.1.1.243
176195```
177196
178- #### Get Load Balancer ID
197+ #### Get Load Balancer IDs
179198
180- Obtain the ID of the ` loadbalancerrule ` we created earlier.
199+ Obtain the IDs of the ` loadbalancerrules ` we created earlier.
181200
182201``` bash
183202$ cmk list loadbalancerrules | jq -r ' .loadbalancerrule[]| [.id, .publicip, .name] | @tsv' | sort -k2
184203ede6b711-b6bc-4ade-9e48-4b3f5aa59934 10.0.0.102 k8s-api
204+ fcf6ed39-44d9-469e-bbc0-1b44d2b5b303 10.0.0.102 talos-api
1852051bad3c46-96fa-4f50-a4fc-9a46a54bc350 10.0.0.197 ac0b5d98cf6a24d55a4fb2f9e240c473-tcp-443
186- $ export LB_RULE_ID=ede6b711-b6bc-4ade-9e48-4b3f5aa59934
206+ $ export LB_RULE_K8S_API_ID=ede6b711-b6bc-4ade-9e48-4b3f5aa59934
207+ $ export LB_RULE_TALOS_API_ID=fcf6ed39-44d9-469e-bbc0-1b44d2b5b303
187208```
188209
189210#### Assign Talos VM to Load Balancer
190211
191- With the ID of the VM and the load balancer , we can assign the VM to the ` loadbalancerrule ` , making the K8S API endpoint available via the Load Balancer
212+ With the ID of the VM and the load balancers , we can assign the VM to the ` loadbalancerrules ` , making the K8S and the Talos API endpoint available via the Load Balancer
192213
193214``` bash
194- cmk assigntoloadbalancerrule id=${LB_RULE_ID} virtualmachineids=${VM_ID}
215+ cmk assigntoloadbalancerrule id=${LB_RULE_K8S_API_ID} virtualmachineids=${VM_ID}
216+ cmk assigntoloadbalancerrule id=${LB_RULE_TALOS_API_ID} virtualmachineids=${VM_ID}
195217```
196218
197219### Bootstrap Etcd
@@ -203,13 +225,18 @@ Configure `talosctl` with IP addresses of the control plane node's IP address.
203225Set the ` endpoints ` and ` nodes ` :
204226
205227``` bash
206- talosctl --talosconfig talosconfig config endpoint ${VM_IP }
207- talosctl --talosconfig talosconfig config node ${VM_IP }
228+ talosctl --talosconfig talosconfig config endpoint ${PUBLIC_IPADDRESS }
229+ talosctl --talosconfig talosconfig config node ${PUBLIC_IPADDRESS }
208230```
209231
210232Next, bootstrap ` etcd ` :
211233
234+ > Note: ` talosctl ` tries to lookup the configuration in the directory ` ~/.talos/config ` , even if the flag
235+ > ` --talosconfig ` is set. To be on the safe side, create an environment variable ` TALOSCONFIG ` containing the path
236+ > to the generated configuration file:
237+
212238``` bash
239+ export TALOSCONFIG=$( pwd) /talosconfig
213240talosctl --talosconfig talosconfig bootstrap
214241```
215242
0 commit comments