The Kubernetes connector is a platform-agnostic connector that you can use to connect to any Kubernetes cluster.
You can use the Kubernetes Connector to securely perform kubernetes operations in CICD pipelines, or use it in kubernetes workloads to perform kubernetes operations without credentials.
Additionally, you can centralize the management of kubernetes access configurations across namespaces, avoiding the need to repeat the kubernetes credentials in each namespace.
This document covers:
Target Kubernetes clusters must meet the following prerequisites:
Here's how to create a basic Kubernetes Connector:
spec.connectorClassName:
k8s (constant), specifies the ConnectorClass name for Kubernetes integration.
spec.address:
Target Kubernetes cluster API server endpoint, for example: https://192.168.1.100:6443.
It also supports url with path, for example: https://192.168.1.100:6443/kubernetes/global, it is useful when the kubernetes cluster API server is exposed behind a proxy.
spec.auth:
specifies the authentication method of the kubernetes cluster.
spec.auth.name: should be bearerTokenAuth for kubernetes connector.
spec.auth.secretRef: specifies the secret that contains the authentication information of the kubernetes cluster, the secret should be created in the same namespace as the connector.
For more information about authentication, see Authentication.
Optional Metadata fields:
cpaas.io/description: Description information for the kubernetes connector, for example:
The Kubernetes connector supports the following authentication types:
bearerTokenAuth: Bearer token-based authentication, corresponding secret type: connectors.cpaas.io/bearer-tokenIf the secret is not correct, the status.conditions field in the kubernetes connector will show the error message.
For comprehensive status information, see Connector Status Documentation.
The required permissions for the configured token depend on how you intend to use it in your Pods/Pipelines.
For example:
create permissions for the corresponding resources in the target cluster.get and list permissions for the relevant resources.For security best practices, we recommend creating tokens with minimal required permissions. When additional privileges are needed, create separate Connectors with more privileged tokens and use namespace isolation to control which users can access each Connector.
Bearer tokens are typically generated from ServiceAccounts in the target Kubernetes cluster. You can create a ServiceAccount with appropriate RBAC permissions and use its token. For detailed information about ServiceAccount tokens and RBAC configuration, see the Kubernetes Authentication documentation.
If you are using an API endpoint provided by the to access your cluster (e.g., https://platform.example.com/kubernetes/global), you must configure an ACP platform token instead of a token generated directly from the Kubernetes cluster. For information about platform tokens, see the documentation.
To provide clients with the ability to access kubernetes resources without credentials, the Kubernetes connector provides a proxy server to automatically inject authentication information.
Clients can use this proxy server to access kubernetes resources without needing to configure credentials on the client side.
To simplify usage, the Kubernetes connectorclass provides kubeconfig files that can be mounted into Pods via CSI. In the Pod, when executing kubernetes operations, the proxy service can be automatically inject authentication information.
Upon Connector creation, the system automatically provisions a proxy service for the target cluster.
The proxy endpoint is recorded in status.proxy.httpAddress:
For example:
The Kubernetes connector provides the following configuration:
kubeconfig:
kubeconfig configuration file. Combined with the connector-csi-driver, this configuration file will be mounted into the Pod, allowing access to the kubernetes cluster through the proxy without needing to configure credentials on the client side.Example of the configuration file generated in the Pod:
Key Fields:
server: Target Kubernetes API server endpointproxy-url: Connector proxy address with embedded proxy authenticationcertificate-authority-data: Proxy server certificate for TLS validationFor detailed proxy mechanics, see How It Works in the Quick Start guide.
The Kubernetes connector provides a kubeconfig configuration file that can be mounted into the Pod via Connector CSI Driver.
For example:
parameter descriptions:
csi.readOnly: Fixed value truecsi.driver: The Connector CSI Driver, fixed as connectors-csi.csi.volumeAttributes: CSI Volume attributes
connector.name: Name of the Kubernetes Connectorconnector.namespace: Namespace of the Kubernetes Connector; if not specified, the Pod's namespace is usedconfiguration.names: Configuration name, provide by the Kubernetes Connector. As above, kubeconfig is supported.For detailed information about how to use the kubeconfig file in the Pod by connectors-csi-driver, please refer to Using Kubernetes Connectors in kubernetes jobs