# Kubernetes

## Example Usage

***

{% tabs %}
{% tab title="Terraform" %}
{% code title="k8s-roles-integration.tf" %}

```tf
resource "apono_integration" "k8s-roles-integration" {
  name                     = "Kubernetes"
  type                     = "k8s-roles"
  connector_id             = "apono-connector-id"
  connected_resource_types = ["k8s-cluster"]
  metadata = {
    cluster_name = "<kubeconfig Cluster Name>"
    kubeconfig_api_server_url = "<kubeconfig Server URL>"
    server_url = "<Server URL>"
    certificate_authority = "<Certificate Authority>"
    enable_session_audit = "<Audit sessions>"
    credentials_rotation_period_in_days = "<Credentials rotation period (in days)>"
    credentials_cleanup_period_in_days = "<User cleanup after access is revoked (in days)>"
  }
  kubernetes_secret = {
    name      = "name_template_value"
    namespace = "namespace_template_value"
  }
}
```

{% endcode %}
{% endtab %}

{% tab title="Terraform V2" %}
{% code title="k8s-roles-integration.tf" %}

```tf
resource "apono_resource_integration" "k8s-roles-integration" {
  name                     = "Kubernetes"
  type                     = "k8s-roles"
  connector_id             = "apono-connector-id"
  connected_resource_types = ["k8s-cluster"]
  integration_config = {
    cluster_name = "<kubeconfig Cluster Name>"
    kubeconfig_api_server_url = "<kubeconfig Server URL>"
    server_url = "<Server URL>"
    certificate_authority = "<Certificate Authority>"
    enable_session_audit = "<Audit sessions>"
    credentials_rotation_period_in_days = "<Credentials rotation period (in days)>"
    credentials_cleanup_period_in_days = "<User cleanup after access is revoked (in days)>"
  }
  secret_store_config = {
    kubernetes = {
      name      = "name_template_value"
      namespace = "namespace_template_value"
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Public API" %}
{% code title="k8s-roles-integration.json" %}

```json
{
    "k8s-roles-integration": {
        "name": "Kubernetes",
        "type": "k8s-roles",
        "connector_id": "apono-connector-id",
        "connected_resource_types": [
            "k8s-cluster"
        ],
        "integration_config": {
            "cluster_name": "<kubeconfig Cluster Name>",
            "kubeconfig_api_server_url": "<kubeconfig Server URL>",
            "server_url": "<Server URL>",
            "certificate_authority": "<Certificate Authority>",
            "enable_session_audit": "<Audit sessions>",
            "credentials_rotation_period_in_days": "<Credentials rotation period (in days)>",
            "credentials_cleanup_period_in_days": "<User cleanup after access is revoked (in days)>",
        },
	"secret_store_config": {
    	    "name": "name_template_value",
    	    "namespace": "namespace_template_value"
  	    }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Schema

***

* `type` k8s-roles
* `connected_resource_types` List of resource types to sync.

<details>

<summary>Available resource types you can use</summary>

* k8s-cluster
* k8s-namespace
* k8s-secret
* k8s-configmap
* k8s-deployment
* k8s-statefulset
* k8s-ingress
* k8s-cronjob
* k8s-job
* k8s-daemonset

</details>

### Integration Config

***

* `cluster_name` (Required | String) kubeconfig Cluster Name
* `kubeconfig_api_server_url` (Required | String) kubeconfig Server URL
* `server_url` (Optional | String) Server URL
* `certificate_authority` (Optional | String) Certificate Authority
* `enable_session_audit` (Optional | String) Audit sessions
  * Default value: `false`
  * Possible values: true, false
* `credentials_rotation_period_in_days` (Optional | String) Credentials rotation period (in days)
* `credentials_cleanup_period_in_days` (Optional | String) User cleanup after access is revoked (in days)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apono.io/metadata-for-integration-config/integration-metadata/k8s-roles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
