|
| 1 | +## OpenID Connect (OIDC) with Cluster API Provider for Oracle Cloud Infrastructure (CAPOCI) |
| 2 | + |
| 3 | +### Overview |
| 4 | + |
| 5 | +Cluster API Provider for Oracle Cloud Infrastructure (CAPOCI) allows you to manage Kubernetes clusters on Oracle Cloud Infrastructure (OCI). Enabling OIDC in managed clusters using CAPOCI involves configuring the cluster to use OIDC for authentication and ensuring that the necessary components are set up correctly. |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +1. **OIDC Provider**: You need an OIDC provider (e.g., Auth0, Okta, Google Identity Platform, Oracle IDCS,etc.). |
| 10 | +2. Ability to create Enhanced OKE clusters. |
| 11 | + |
| 12 | +#### Update CAPOCI Configuration |
| 13 | + |
| 14 | +The example below shows how to update the CAPOCI configuration to include the OIDC settings. This involves modifying the `OCIManagedControlPlane` resource to enable OIDC authentication. |
| 15 | + |
| 16 | +**Example `OCIManagedControlPlane` Configuration:** |
| 17 | + |
| 18 | +``` |
| 19 | +kind: OCIManagedControlPlane |
| 20 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 |
| 21 | +metadata: |
| 22 | + name: "${CLUSTER_NAME}" |
| 23 | + namespace: "${NAMESPACE}" |
| 24 | +spec: |
| 25 | + version: "${KUBERNETES_VERSION}" |
| 26 | + clusterType: "ENHANCED_CLUSTER" |
| 27 | + clusterOptions: |
| 28 | + openIdConnectDiscovery: |
| 29 | + isOpenIdConnectDiscoveryEnabled: true |
| 30 | + openIdConnectTokenAuthenticationConfig: |
| 31 | + isOpenIdConnectAuthEnabled: true |
| 32 | + clientId: "<OIDC Configuration Client ID>" |
| 33 | + issuerUrl: "<OIDC issuer URL>" |
| 34 | + groupsClaim: "<OIDC Configuration Groups Claim>" |
| 35 | + groupsPrefix: "<OIDC Configuration Groups Prefix>" |
| 36 | + usernameClaim: "<OIDC Configuration Username Claim>" |
| 37 | + requiredClaims: |
| 38 | + - "<OIDC Configuration Required Claims(key: value)>" |
| 39 | + groupsPrefix: "<OIDC Configuration Groups Prefix>" |
| 40 | + usernamesPrefix: "<OIDC Configuration Usernames Prefix>" |
| 41 | + signingAlgorithm: "<OIDC Configuration Signing Algorithm>" |
| 42 | + caCertificate: "<OIDC Configuration CA Certificate>" |
| 43 | +``` |
| 44 | + |
| 45 | +**Explanation of Fields:** |
| 46 | + |
| 47 | +- `clusterType`: Specifies the type of cluster. For OIDC, it should be set to `ENHANCED_CLUSTER`. This feature is not available for basic clusters. |
| 48 | +- `openIdConnectDiscovery`: Enables OIDC discovery. `isOpenIdConnectDiscoveryEnabled` should be set to `true`. |
| 49 | +- `isOpenIdConnectAuthEnabled`: Set to `true` to enable OIDC authentication. |
| 50 | +- `clientId`: The client ID obtained from your OIDC provider. |
| 51 | +- `issuerUrl`: The issuer URL of your OIDC provider. |
| 52 | +- `groupsClaim`: The claim to use for group membership (optional). |
| 53 | +- `usernameClaim`: The claim to use for the username (optional). |
| 54 | +- `requiredClaims`: Additional claims that must be present in the token (optional). |
| 55 | +- `groupsPrefix`: Prefix to add to group names (optional). |
| 56 | +- `usernamesPrefix`: Prefix to add to usernames (optional). |
| 57 | +- `signingAlgorithm`: The signing algorithm used by the OIDC provider (optional, default is [\"RS256\"]). |
| 58 | +- `caCertificate`: The CA certificate used to verify the OIDC provider's TLS certificate (optional). |
| 59 | + |
| 60 | +**Note:** Ensure that the values for `clientId`, `issuerUrl`, and other fields are correctly configured according to your OIDC provider's settings. |
0 commit comments