Cluster Authentication

This plugin provides independent authentication integration for global cluster failure scenarios. When the global cluster fails, users can still log in through this service to access and operate the Kubernetes cluster, maintaining permissions consistent with the state before the global cluster failure (note: group permissions are not supported).

TOC

Overview

The authentication integration uses Connector Custom Resources (CRs) to configure OIDC or LDAP identity providers.

Connector CR Basics

  • CR Kind: Connector (apiVersion: dex.coreos.com/v1)
  • Namespace: cpaas-system
  • Config Format: The config field must be a base64-encoded JSON string. Create your configuration as a JSON file, then encode it using base64 -w0 config.json (on macOS, the -w0 flag can be omitted).

Connector CR Template:

apiVersion: dex.coreos.com/v1
kind: Connector
metadata:
  name: <connector-name>
  namespace: cpaas-system
  labels:
    cpaas.io/idp.version: v2  # connector version marker
spec:
  type: <oidc|ldap>           # connector type
  id: <connector-id>          # globally unique in the platform
  name: <display-name>        # shown on login screen
  config: <base64-encoded-connector-config-json>

Integrated with LDAP

LDAP Configuration

Example LDAP connector configuration:

{
  "bindDN": "cn=Administrator,cn=Users,dc=example,dc=com",
  "bindPW": "<password>",
  "host": "ldap.example.com:389",
  "insecureNoSSL": true,
  "insecureSkipVerify": true,
  "startTLS": true,
  "userSearch": {
    "baseDN": "dc=example,dc=com",
    "filter": "(objectClass=organizationalPerson)",
    "idAttr": "distinguishedName",
    "nameAttr": "cn",
    "username": "cn",
    "emailAttr": "mail"
  }
}

Field descriptions:

FieldDescriptionRequiredNotes
bindDNBind account DNYesNeeds search permission
bindPWBind account passwordYesPaired with bindDN
hostLDAP host:port Yes389+StartTLS or 636 (LDAPS)
insecureNoSSLDisable SSLYesSet to true
startTLSEnable StartTLSYesSet to true
insecureSkipVerifySkip TLS verifyYesSet to true
userSearch.baseDNSearch base DNYesDirectory root or organizational DN
userSearch.filterUser filterYese.g., (objectClass=organizationalPerson)
userSearch.idAttrUnique ID attributeYese.g., distinguishedName
userSearch.nameAttrDisplay/identity attributeYesUsed as platform-side identifier
userSearch.usernameLogin attribute(s)YesComma-separated candidates
userSearch.emailAttrEmail attributeNoOmit if directory lacks email

Apply LDAP Connector

Step-by-step instructions:

# 1) Create JSON config file
cat <<'EOF' > ldap-config.json
{
  "bindDN": "cn=Administrator,cn=Users,dc=example,dc=com",
  "bindPW": "<password>",
  "host": "ldap.example.com:389",
  "insecureNoSSL": true,
  "insecureSkipVerify": true,
  "startTLS": true,
  "userSearch": {
    "baseDN": "dc=example,dc=com",
    "filter": "(objectClass=organizationalPerson)",
    "idAttr": "distinguishedName",
    "nameAttr": "cn",
    "username": "cn",
    "emailAttr": "mail"
  }
}
EOF

# 2) Base64 encode the config
LDAP_B64=$(base64 -w0 ldap-config.json)

# 3) Create Connector CR
cat <<EOF > ldap-connector.yaml
apiVersion: dex.coreos.com/v1
kind: Connector
metadata:
  name: ldap-sample
  namespace: cpaas-system
  labels:
    cpaas.io/idp.version: v2
spec:
  type: ldap
  id: ldap-sample
  name: LDAP Sample
  config: ${LDAP_B64}
EOF

# 4) Apply the Connector
kubectl apply -f ldap-connector.yaml

Integrated with OIDC

OIDC Configuration

Example OIDC connector configuration:

{
  "issuer": "https://idp.example.com/auth/realms/master",
  "issuerAlias": "",
  "clientID": "<client-id>",
  "clientSecret": "<client-secret>",
  "redirectURI": "https://<clusterEndpoint>:11780/dex/callback",
  "scopes": ["openid", "profile", "email", "groups"],
  "claimMapping": {
    "email": "email",
    "preferred_username": "preferred_username",
    "groups": "groups"
  },
  "getUserInfo": true,
  "insecureSkipVerify": true
}

Field descriptions:

FieldDescriptionRequiredNotes
issuerUpstream IdP issuerYesMust match IdP metadata
clientIDOIDC client IDYesCreated in IdP
clientSecretOIDC client secretYesPaired with clientID
redirectURIDex callbackYesMust match IdP registration. Example: https://<clusterEndpoint>:11780/dex/callback
scopesOIDC scopesYesRecommended: openid, profile, email, groups
claimMapping.emailEmail mappingYesMap to upstream claim
claimMapping.preferred_usernameUsername mappingOptionalMap to upstream claim
claimMapping.groupsGroup mappingOptionalIf upstream provides groups
getUserInfoCall UserInfo endpointNoSet to true if ID Token lacks fields
insecureSkipVerifySkip TLS verifyYesSet to true (per current config)

Apply OIDC Connector

Step-by-step instructions:

# 1) Create JSON config file
cat <<'EOF' > oidc-config.json
{
  "issuer": "https://idp.example.com/auth/realms/master",
  "issuerAlias": "",
  "clientID": "<client-id>",
  "clientSecret": "<client-secret>",
  "redirectURI": "https://<clusterEndpoint>:11780/dex/callback",
  "scopes": ["openid", "profile", "email", "groups"],
  "claimMapping": {
    "email": "email",
    "preferred_username": "preferred_username",
    "groups": "groups"
  },
  "getUserInfo": true,
  "insecureSkipVerify": true
}
EOF

# 2) Base64 encode the config
OIDC_B64=$(base64 -w0 oidc-config.json)

# 3) Create Connector CR
cat <<EOF > oidc-connector.yaml
apiVersion: dex.coreos.com/v1
kind: Connector
metadata:
  name: oidc-sample
  namespace: cpaas-system
  labels:
    cpaas.io/idp.version: v2
spec:
  type: oidc
  id: oidc-sample
  name: OIDC Sample
  config: ${OIDC_B64}
EOF

# 4) Apply the Connector
kubectl apply -f oidc-connector.yaml
INFO

Important Notes:

  • Place Connector CRs in the cpaas-system namespace to align with the global cluster setup.
  • Base64 encoding: On Linux use base64 -w0 config.json, on macOS the -w0 flag can be omitted.

Use AC CLI to Connect to ACP

This section describes how to use the AC CLI to authenticate and connect to the ACP (Application Control Plane) using the configured identity providers.

Prerequisites

Before using AC CLI to connect, ensure the following:

  1. AC CLI is installed (version >= 1.1)
  2. Cluster is reachable over the network
  3. External access address of the plugin auth service: https://<clusterEndpoint>:<DefaultPort> (default DefaultPort is 11780)
  4. Connector is configured for the target IDP and the Connector CR name is confirmed

Verify the Connector configuration:

kubectl get connector -n cpaas-system

Example output:

NAME        AGE
ldap-test   7m53s
oidc-test   6m27s

Command Examples

Login with LDAP identity provider:

ac login https://<clusterEndpoint>:11780 \
  --idp <ldap-connector-name> \
  --workload \
  --auth-type ldap \
  --username '<username>' \
  --password '<password>'

Login with OIDC identity provider:

ac login https://<clusterEndpoint>:11780 \
  --idp <oidc-connector-name> \
  --workload \
  --auth-type oidc
TIP

For OIDC authentication, if interactive authentication is required, follow the CLI prompts to complete the login process.

Command Parameters

ParameterDescriptionRequiredNotes
--idpConnector nameYesThe name of the Connector CR configured in cpaas-system namespace
--workloadLogin to workload clusterYesFlag to indicate logging in to the workload cluster
--auth-typeAuthentication typeYesSupported values: ldap, oidc
--usernameUsername for LDAPYes (LDAP only)Used for LDAP authentication
--passwordPassword for LDAPYes (LDAP only)Used for LDAP authentication