Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eumel8/tf-kubeadm-otc

Install One Node Kubernetes Cluster with kubeadm on OTC
https://github.com/eumel8/tf-kubeadm-otc

Last synced: 28 days ago
JSON representation

Install One Node Kubernetes Cluster with kubeadm on OTC

Awesome Lists containing this project

README

        

# tf-kubeadm-otc

Install Kubeadm OTC with Tofu

## Pre-requirements

* install [tofu](https://opentofu.org/docs/intro/install/)
* have a OTC tenant and AK/SK credentials

## Deployment

* Create a `terraform.tfvars` file in the main folder

mandatory flags:

```
# app
environment = # e.g. "kubeadm-test"
kubeadm_host = # e.g. "kubeadm"
kubeadm_domain = # e.g. "example.com"
create_dns = "true"
flavor_id = "c3.xlarge.2"
# secret
access_key =
secret_key =
domain_name = "
public_key =
```

additional features (optional):

```
create_dns = # e.g. "true"
admin_email = # e.g. "[email protected]"
```

```
tofu init
tofu plan
tofu apply -auto-approve
```

## kubeadm installation

There are various steps to prepare Kubernetes installation done by [cloud-init](files/kubeadm)

* set kernel parameters
* set container engine
* install kubeadm, kubelet, kubectl
* create the cluster (single node)
* untain the control-node and make this as worker
* install tooling like helm
* install local-storage provisioner
* generate kube config credential file to download via ssh

## Output

After `tofu apply` or `tofu output` show a lot of information to access the cluster:

```bash
Outputs:

kubeadm-api = "https://kubeadm.otc.mcsps.de"
kubeadm-info = [
"Welcome to Kubeadm at OTC! It will take up to 5 minutes before your cluster is ready and accessable",
"To get kubeadm config from lighttpd server:",
"curl -o kubeadm.config http://164.30.35.56:8181/cvivcfat6mol7te0e4jxr5zez0m0ig53/kubeadm.config",
"export KUBECONFIG=$(pwd)/kubeadm.config",
"To get kubeadm config via scp:",
"scp [email protected]:/var/www/html/cvivcfat6mol7te0e4jxr5zez0m0ig53/kubeadm.config .;export KUBECONFIG=./kubeadm.config",
"To access the server via ssh:",
"ssh [email protected]",
"We provided some additional resource via install script on /install-software.sh",
"To get: curl -o install-software.sh http://164.30.35.56:8181/cvivcfat6mol7te0e4jxr5zez0m0ig53/install-software.sh",
]

$ scp [email protected]:/var/www/html/cvivcfat6mol7te0e4jxr5zez0m0ig53/kubeadm.config .;export KUBECONFIG=./kubeadm.config
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
kubeadm-test-kubeadm Ready control-plane 6m19s v1.28.15
```

## Software

Within cloud-init a file named /install-software.sh will installed. It can be executed to install

- kube-prometheus-stack
- kube-logging
- ingress-nginx
- kube-vip

see hints in the file for further information

## Shutdown-Mode

Since Version 1.23.6 Terraform Open Telekom Cloud can handle ECS instance power state.

Shutoff:

```
tofu apply -auto-approve --var power_state=shutoff
```

Active:

```
tofu apply -auto-approve --var power_state=active
```

## Retirement:

```
tofu destroy
```

## Credits:

Frank Kloeker

Life is for sharing. If you have an issue with the code or want to improve it,
feel free to open an issue or an pull request.