Connect an Oracle OKE Cluster
Connect an Oracle OKE Cluster in Tenable One Cloud Exposure to get full visibility and risk assessment for all cloud identities and resources associated with the cluster, including information about permissions, subscription usage, and security configurations.
Until you complete the integration, objects and configurations associated with the cluster will not be analyzed or available for investigation in Tenable. A sync status is displayed for each Kubernetes cluster in the relevant inventory view, indicating whether Tenable can connect to the Kubernetes API, and helping you troubleshoot potential connection issues.
Requirements
For each cluster you want to monitor, perform both of the following steps. In situations where it's not possible or practical to perform one or both of these steps, Tenable offers an alternative integration path using Helm charts.
- Grant Cluster Permissions.
- If the Tenable role doesn't have permissions to access the cluster, connect the cluster via Helm Chart instead.
- Allow Network Access to Tenable.
- If the cluster control plane is not publicly accessible, connect the cluster via Helm Chart instead. For example, in the case of a private cluster.
Grant Cluster Permissions
To connect your Kubernetes cluster to Tenable, you must grant permissions using both the CLI and your OCI policy.
Grant Cluster Permissions via CLI
Provide Tenable access to your cluster by granting the Tenable group role permissions to the cluster. This is done by adding the Tenable group role to your OKE cluster, by creating a ClusterRole and ClusterRoleBinding. The following procedure shows how to do this using the kubectl command. For more information, follow the guidelines outlined in the Oracle OKE documentation.
Prerequisites:
- Ensure that you have the necessary permissions to perform this action.
-
Verify that the following tools are installed:
- OCI CLI
- kubectl
To connect an OKE Cluster:
-
Run the following command via the OCI CLI:
oci ce cluster create-kubeconfig cluster-id {your_cluster_ocid} --file $HOME/.kube/config region {your_region} --token-version {your_token_version} --kube-endpoint {your_endpoint_type}
Note: --token-version: Refer to the official Oracle documentation for details. --kube-endpoint: Refer to the official Oracle documentation for details. -
Run the following command:
cd ~/.kube
-
Create a cluster role YAML file:
Run the following command to edit the file:
vim {clusterRole}.yaml
Where {clusterRole} is the name that you choose to give the file.
Add the following clusterRole:
CopyYAML
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: tenable-kube-connector-cluster-role
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list", "watch"]
-
Create a cluster role binding YAML file:
Run the following command to edit the file:
vim {clusterRoleBinding}.yaml
Where {clusterRoleBinding} is the name that you choose to give the file.
Add the following clusterRoleBinding:
CopyYAML
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tenable-kube-connector-cluster-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: tenable-kube-connector-cluster-role
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: {tenable_group_ocid}Note: tenable_group_ocid = The group ID you created via the OCI integration process. See the documentation for more information.
-
Run the following commands to apply the clusterRole/clusterRoleBinding that you created to the cluster:
kubectl apply -f ./{clusterRole}.yaml
kubectl apply -f ./{clusterRoleBinding}.yamlWhere {clusterRole}and {clusterRoleBinding} are the names that you gave the YAML files.
-
(Optional) Verify that the clusterRole/clusterRoleBinding were applied by running the following commands:
kubectl get clusterroles
kubectl get clusterrolebindings
Grant Cluster Permissions via OCI Policy
Grant Cloud Exposure permissions to scan OCI Kubernetes by creating a new OCI policy and assigning the required permissions using policy statements.
To grant Kubernetes cluster resources read permissions
- In the Oracle console, navigate to Identity & Security > Identity > Policies.
-
Click Create Policy and enter the following details:
- Name: Enter a meaningful name.
- Description: Enter a meaningful description
- Compartment: Select the root compartment
-
In the Policy Builder, click Show manual editor and add the following statement:
Allow group {tenable_group_name} to use clusters in tenancy
Note: tenable_group_name = The group name you created via the OCI integration process. See the documentation for more information.
Allow Network Access to Tenable
For Cloud Exposure to access the cluster, the cluster endpoint needs to be publicly accessible, and the relevant Tenable IP addresses need to be allowed.
To allow network access:
- In the OCI Management Console, navigate to Developer Services > Containers & Artifacts > OKE.
- Click on the relevant Cluster name.
-
Click on Edit and select Assign a public IP address to the API endpoint.
- Public and private — If selected, you can navigate to the cluster's Virtual Cloud Network settings > Security > Cluster's K8s API Endpoint Rule > Security rules, and edit the ingress rules to only allow traffic from the Tenable IP addresses associated with your Tenable region.
- When finished, click Save changes.