Prepare Cluster Access Credential
This guide shows you how to create a cluster access credential that help you run your Tekton Tasks and Pipelines.
TOC
PrerequisitesStepsOption 1: Create a Kubeconfig SecretOption 2: Create a ServiceAccount with RBACPrerequisites
- kubectl installed and configured to access the cluster.
- Permissions to read and write Secrets.
Steps
Option 1: Create a Kubeconfig Secret
Provide a kubeconfig with a context that has the right cluster/permissions.
Keep this kubeconfig minimal (only the context you need). Rotate regularly and scope RBAC tightly.
You can use the following command to generate a Secret that contains the kubeconfig file.
Replace /path/to/kubeconfig with the actual path to your kubeconfig file.
Option 2: Create a ServiceAccount with RBAC
Use a dedicated ServiceAccount. Bind only the permissions your charts need.
When to use which scope?
- Namespaced scope (Role + RoleBinding) — use when your charts manage resources only in one namespace (typical app rollouts).
- Cluster scope (ClusterRole + ClusterRoleBinding) — required if your charts create cluster-scoped resources (e.g., CRDs, webhooks, ClusterRoles, StorageClasses) or operate across multiple namespaces.
tips: start with the namespaced Role; grant cluster-scope only when strictly required.