This folder provides an **Ansible-based automation framework** to set up a multi-node Kubernetes cluster for ETSI MEC Sandbox.
This folder provides an **Ansible-based automation framework** to set up a multi-node Kubernetes cluster and deploy the ETSI MEC Sandbox platform.
---
@@ -10,6 +10,10 @@ Before running the playbooks, ensure:
1. You have **Ansible** installed on your control machine.
2. You have **SSH access** to all remote nodes (master & workers, if applicable).
3. Both repositories are cloned as siblings in the same parent directory:
-`etsi-mec-sandbox` (backend)
-`etsi-mec-sandbox-frontend` (frontend)
4. You have a **GitHub OAuth application** configured (Client ID & Secret for MEC Sandbox authentication).
> **Note:** If your playbooks are running on `localhost` (control machine itself), **SSH is not required**. SSH setup is only necessary for remote worker or master nodes.
*`container_runtime`: `"containerd"` (default) or `"docker"`
*`kube_version`: `"1.29.*"`
*`pod_network_cidr`: `"192.168.0.0/16"`
### Kubernetes & Container Runtime
*`kubernetes_version`: `"v1.35"`
*`pod_network_cidr`: `"92.68.0.0/16"`
*`service_cidr`: `"10.96.0.0/12"`
*`calico_version`: `"v3.30.0"`
### Development Environment
*`install_dev_env`: `true` → set to `false` to disable Node/Go tooling
*`go_version`: `"1.17"`
*`node_version`: `"12.19.0"`
### MEC Sandbox
*`install_mec_sandbox`: `true` → set to `false` to skip MEC Sandbox deployment
*`mec_sandbox_dir`: Path to the etsi-mec-sandbox repository
*`mec_frontend_dir`: Path to the etsi-mec-sandbox-frontend repository
## Tags
You can run just parts of the setup with `--tags` or skip parts with `--skip-tags`. (The roles here are intentionally simple and do not define custom tags; feel free to add them if you want finer control.)
### 1. Generate GitHub OAuth App Client ID & Secret
The MEC Sandbox uses GitHub OAuth for authentication. You need to register an OAuth App in your GitHub account's Developer Settings to obtain a **Client ID** and **Client Secret**.
**Steps:**
1. Log in to [GitHub](https://github.com) and go to your account **Settings**.
2. In the left sidebar, scroll down and click **Developer settings**.
3. Click **OAuth Apps** → **New OAuth App**.
4. Fill in the application details:
-**Application name**: e.g., `MEC Sandbox`
-**Homepage URL**: e.g., `https://<VM_IP>` (or Deployment URL or VM IP)
3. Run the playbook for master first (to initialize control plane and produce join script):
3. Uncomment the worker play in `site.yml`.
4. Run the playbook for master first (to initialize control plane and produce join script):
```bash
ansible-playbook -K-l k8s_masters site.yml
```
After successful run, a join command will be generated on the master at `/tmp/kube_join_cmd.sh`. You can retrieve it with `scp` or `ansible.builtin.fetch`.
4. Copy the `/tmp/kube_join_cmd.sh` to each worker node (e.g., `/tmp/kube_join_cmd.sh`) so that the worker play can use it. Example using scp:
After successful run, a join command will be generated on the master at `/tmp/kube_join_cmd.sh`.
5. Copy the `/tmp/kube_join_cmd.sh` to each worker node:
Alternatively, you can fetch it programmatically in Ansible from master and distribute to workers via a small play/role.
5. Run the worker play:
6. Run the worker play:
```bash
ansible-playbook -K-l k8s_workers site.yml
```
**Notes:**
- Worker nodes will only run `common`, `kernel`, `containerd` (or `docker`), and `kubernetes/worker` roles.
- The `kubernetes/worker` role expects a join script (created on master) at `/tmp/kube_join_cmd.sh`. If you prefer, you can expose the master token & CA hash via a secure variable and run `kubeadm join` directly in the role.
No newline at end of file
---
## Conditional Roles
The following roles can be enabled/disabled via variables in `group_vars/all.yml`: