# MetaKube

You can use MetaKube via its HTTP JSON API, or its [Terraform Provider](<https://registry.terraform.io/providers/syseleven/metakube/latest/docs>). You can view a simple [Terraform example](<https://documentation.syseleven.de/en/how-to/kubernetes/metakube-terraform-example/index.md>).

## OpenAPI Specs

> [!NOTE]
>
> **Service Account Required**
>
> To use the API, please [first create a Service Account](<https://documentation.syseleven.de/en/products/iam/usage/service-accounts/#create-service-account>). Then use the Service Account as a bearer token, s.t. `Authorization: Bearer <api-key>` in the header of your requests.

## Example: Using the HTTP JSON API

Here's an example of how to use the Service Account with a cURL command to access the MetaKube API:

```bash
curl -X 'GET' \
  'https://metakube.syseleven.de/api/v2/projects/<project-id>/clusters' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer s11_prak_<uuid>_<secret>'
```

Replace `<project-id>` with your actual project ID and `s11_prak_<uuid>_<secret>` with your generated Service Account credentials and make sure that the Service Account has the necessary permissions to access the resources you need.

## Cluster Access — MetaKube

> [!WARNING]
>
> **Early Access**
>
> You need to enable the [MetaKube OIDC support](<https://documentation.syseleven.de/en/discover/core-concepts/dashboard/#early-access-features>) before you can use this feature.  
>   
> This feature is currently in a pre-release state and is **not** yet final. It may be updated or changed without prior notice. As it is still being refined, you may encounter occasional inaccuracies or bugs.
>
> **Important:** In its current state we recommend use for evaluation and testing purposes only and **not** for production environments. For any questions or to report issues, please contact our support team.

Login to access MetaKube clusters via OIDC. Follow the steps below to configure this.

1. Ensure that you have installed the [`kubelogin` plugin](<https://github.com/int128/kubelogin?tab=readme-ov-file#setup>) for `kubectl`.
2. Head to your cluster details page and click on the `Access Control` tab.
3. Click on the ENABLE button.
4. Configure user and group roles under `Cluster Access`. Specify users by their email address or groups by their teams.

> [!NOTE]
>
> **Info**
>
> OIDC authentication against MetaKube clusters supports user accounts. IAM teams are shown as Kubernetes groups which can be checked with `kubectl auth whoami`
>
> Service accounts can also be used in the kubeconfig. However, an automated download mechanism is not yet available, so you must create the kubeconfig manually.
>
> Or download the admin config using the  DOWNLOAD KUBECONFIG (ADMIN) button.
