mirror of
https://github.com/optim-enterprises-bv/terraform-talos.git
synced 2025-11-01 10:48:36 +00:00
Update docs
This commit is contained in:
87
README.md
87
README.md
@@ -1,22 +1,89 @@
|
|||||||
# terraform-talos
|
# Terraform examples
|
||||||
|
|
||||||
Terraform examples to run Talos
|
Local utilities
|
||||||
|
|
||||||
* terraform
|
* terraform
|
||||||
* talosctl
|
* talosctl
|
||||||
* kubectl
|
* kubectl
|
||||||
* yq
|
* yq
|
||||||
|
|
||||||
## Talos on Hetzner Cloud
|
# Talos on Hetzner Cloud
|
||||||
|
|
||||||
```bash
|
This terraform example install Talos on [HCloud](https://www.hetzner.com/cloud) with IPv4/IPv6 support.
|
||||||
cd hetzner
|
|
||||||
|
|
||||||
# create the cluster configuration
|
## Kubernetes addons
|
||||||
talosctl gen config --output-dir _cfgs --with-docs=false --with-examples=false talos-k8s-hezner https://127.0.0.1:6443
|
|
||||||
yq ea -P '. as $item ireduce ({}; . * $item )' _cfgs/controlplane.yaml templates/controlplane.yaml.tpl > templates/controlplane.yaml
|
* [cilium](https://github.com/cilium/cilium) 1.10.0
|
||||||
|
* [kubelet-serving-cert-approver](https://github.com/alex1989hu/kubelet-serving-cert-approver)
|
||||||
|
* [metrics-server](https://github.com/kubernetes-sigs/metrics-server) 0.5.0
|
||||||
|
* [rancher.io/local-path](https://github.com/rancher/local-path-provisioner) 0.0.19
|
||||||
|
* [hcloud-cloud-controller-manage](https://github.com/hetznercloud/hcloud-cloud-controller-manager) v1.10.0
|
||||||
|
|
||||||
|
## Prepare the base image
|
||||||
|
|
||||||
|
First, prepare variables to your environment
|
||||||
|
|
||||||
|
```shell
|
||||||
|
export TF_VAR_hcloud_token=KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
Terraform will run the VM in recovery mode, replace the base image and take a snapshote. Do not run terraform destroy after. It will delete the snapshot.
|
||||||
kubectl -n kube-system create secret generic hcloud --from-literal=network= --from-literal=token=
|
|
||||||
|
```shell
|
||||||
|
make prepare-image
|
||||||
|
```
|
||||||
|
|
||||||
|
## Install control plane
|
||||||
|
|
||||||
|
Generate the default talos config
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make create-config
|
||||||
|
```
|
||||||
|
|
||||||
|
open config file **terraform.tfvars** and add params
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
# counts and type of kubernetes master nodes
|
||||||
|
controlplane = {
|
||||||
|
count = 1,
|
||||||
|
type = "cpx11"
|
||||||
|
}
|
||||||
|
|
||||||
|
# regions to use
|
||||||
|
regions = ["nbg1", "fsn1", "hel1"]
|
||||||
|
|
||||||
|
# counts and type of worker nodes by redion
|
||||||
|
instances = {
|
||||||
|
"nbg1" = {
|
||||||
|
web_count = 1,
|
||||||
|
web_instance_type = "cx11",
|
||||||
|
worker_count = 1,
|
||||||
|
worker_instance_type = "cx11",
|
||||||
|
},
|
||||||
|
"fsn1" = {
|
||||||
|
web_count = 1,
|
||||||
|
web_instance_type = "cx11",
|
||||||
|
worker_count = 1,
|
||||||
|
worker_instance_type = "cx11",
|
||||||
|
}
|
||||||
|
"hel1" = {
|
||||||
|
web_count = 1,
|
||||||
|
web_instance_type = "cx11",
|
||||||
|
worker_count = 1,
|
||||||
|
worker_instance_type = "cx11",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And deploy the kubernetes master nodes
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make create-controlplane
|
||||||
|
```
|
||||||
|
|
||||||
|
Then deploy all other instances
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make create-infrastructure
|
||||||
```
|
```
|
||||||
|
|||||||
18
hetzner/Makefile
Normal file
18
hetzner/Makefile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
prepare-image:
|
||||||
|
ssh-keygen -f /.ssh/terraform -N '' -t rsa
|
||||||
|
|
||||||
|
cd prepare
|
||||||
|
terraform init
|
||||||
|
terraform apply -auto-approve
|
||||||
|
|
||||||
|
create-config:
|
||||||
|
talosctl gen config --output-dir _cfgs --with-docs=false --with-examples=false talos-k8s-hezner https://127.0.0.1:6443
|
||||||
|
yq ea -P '. as $item ireduce ({}; . * $item )' _cfgs/controlplane.yaml templates/controlplane.yaml.tpl > templates/controlplane.yaml
|
||||||
|
|
||||||
|
create-controlplane:
|
||||||
|
terraform init
|
||||||
|
terraform apply -target=null_resource.controlplane_apply
|
||||||
|
|
||||||
|
create-infrastructure:
|
||||||
|
terraform apply
|
||||||
Reference in New Issue
Block a user