Kubeconfig Merger & Sanitizer
Managing access to multiple Kubernetes clusters often results in a fragmented collection of configuration files scattered across your machine. Whether you are dealing with development, staging, and production clusters, or managing multi-cloud infrastructure across EKS, GKE, and AKS, juggling different files is tedious. The Kubeconfig Merger simplifies this by combining multiple YAML files into a single master configuration, enabling seamless context switching with standard kubectl commands.
Beyond organization, sharing cluster configurations safely is a critical DevOps challenge. Raw kubeconfig files often contain highly sensitive credentials—such as admin tokens, client certificates, and passwords—that grant full access to the cluster. By utilizing our built-in sanitization feature, you can automatically strip out these secrets and replace them with a redacted placeholder. This allows you to safely share structural cluster information with teammates or store it in version control, entirely locally in your browser without uploading any data to a remote server.
or click to select files (up to 5)
Loaded Configurations
Merge & Sanitize Options
Deduplication
Sanitization (Recommended)
This tool runs 100% in your browser; your data never leaves your device. Privacy details
What Is a Kubeconfig File and How kubectl Uses It
A kubeconfig file is a standard YAML file used by the Kubernetes command-line tool, kubectl, to configure access to one or more clusters. It serves as the primary mechanism for authenticating and routing requests to the Kubernetes API server. The file is structured into three main components: clusters, users, and contexts.
The clusters section defines the network endpoints and certificate authorities for the Kubernetes control plane. The users section contains the authentication credentials, such as bearer tokens or client certificates. Finally, the contexts section ties a user to a specific cluster, optionally setting a default namespace. When you run a command like kubectl get pods, the CLI reads the current-context field to determine which cluster to target and which credentials to use.
Merging Multiple Kubeconfig Files: The kubectl Method
While our browser-based tool offers a visual and private way to merge configurations, it's also possible to merge them using native Kubernetes tools. By leveraging the KUBECONFIG environment variable, you can instruct kubectl to read multiple files simultaneously.
For example, running export KUBECONFIG=~/.kube/config-dev:~/.kube/config-prod will temporarily merge the two files in memory. To persist this merged state into a single file, you can execute kubectl config view --flatten > ~/.kube/merged-config. However, this native method does not offer automated sanitization or deduplication strategies, which is why a dedicated merging and sanitization tool is often preferred when preparing configurations for team distribution.
What Sensitive Data Is Inside a Kubeconfig
Because kubeconfig files are designed to provide immediate access to infrastructure, they frequently contain highly sensitive secrets. If an attacker or unauthorized user gains access to an unsanitized file, they could potentially execute arbitrary commands, read sensitive Kubernetes Secrets, or disrupt services.
The primary risks lie in the users array. Authentication mechanisms often embed raw credentials directly in the YAML. This includes client-certificate-data and client-key-data for TLS-based authentication, as well as static token and password fields. Additionally, the clusters array contains certificate-authority-data, which, while generally less sensitive than private keys, is still often redacted when sharing minimal configurations.
Sanitizing Kubeconfig Before Sharing with Your Team
When onboarding a new developer or setting up a shared CI/CD environment, you need to provide connection details without exposing your personal identity or admin-level tokens. A sanitized kubeconfig achieves exactly this by retaining the essential structural data while removing the sensitive bits.
Our Kubeconfig Sanitizer automates this process by aggressively filtering out known credential fields and replacing them with a safe <REDACTED> placeholder. The recipient receives a perfectly valid YAML structure containing the correct API server URLs and cluster names. They can then manually inject their own unique tokens or configure an OIDC authentication plugin without needing to reverse-engineer the cluster configuration from scratch. You can also generate supplementary configuration using a ConfigMap Generator to standardize environment variables.
Managing Multi-Cloud Kubernetes Clusters
Modern infrastructure is rarely confined to a single provider. Organizations frequently deploy workloads across AWS EKS, Google Cloud GKE, and Azure AKS simultaneously. Each cloud provider's CLI tool—such as aws eks update-kubeconfig or gcloud container clusters get-credentials—typically writes to its own specific file or appends to the default ~/.kube/config.
Over time, this results in a bloated, hard-to-manage configuration file littered with stale contexts and duplicated user entries. By periodically exporting your configurations, converting them securely via format converters if needed, and passing them through a deduplication merger, you can maintain a clean, performant workspace. This is especially useful when defining complex routing rules with tools like an Ingress Generator across disparate environments.
KUBECONFIG Environment Variable and Context Switching
Mastering the KUBECONFIG environment variable is essential for advanced Kubernetes administration. By default, kubectl looks for a configuration file at $HOME/.kube/config. However, setting the environment variable allows you to override this behavior per terminal session.
For instance, if you are actively debugging a production issue, you might run export KUBECONFIG=/path/to/prod-config.yaml to guarantee that you don't accidentally execute a destructive command against your development cluster. Once you have merged your disparate files using our tool, you can simply point this environment variable to your new, unified master file, enabling you to use kubectl config use-context to rapidly switch between environments without ever leaving your terminal.
How to Use the Kubeconfig Merger & Sanitizer
- [object Object]
- [object Object]
- [object Object]
- [object Object]
- [object Object]
Common Use Cases
- [object Object]
- [object Object]
- [object Object]
- [object Object]
- [object Object]
- [object Object]
Frequently Asked Questions
What is a kubeconfig file?
A kubeconfig file is a YAML file used to configure access to Kubernetes clusters. It contains cluster details (like server URLs and certificate authorities), user credentials (like tokens or client certificates), and context definitions that link a user to a cluster under a specific namespace.
How do I merge multiple kubeconfig files manually?
Manually, you would have to carefully copy and paste cluster, user, and context arrays from one YAML file to another, ensuring that you don't duplicate names or mess up the YAML indentation. Alternatively, you can use the KUBECONFIG environment variable (e.g., `export KUBECONFIG=file1:file2`) and run `kubectl config view --flatten` to generate a merged file. Our tool automates this process directly in your browser.
Why should I sanitize a kubeconfig before sharing?
Kubeconfig files often contain highly sensitive credentials, such as admin tokens, client certificates, and passwords. If you share a raw kubeconfig, you are granting the recipient full access to your cluster under your identity. Sanitizing strips out these secrets, leaving only the structural cluster and context definitions so teammates can configure their own access.
What sensitive data is in a kubeconfig?
Sensitive fields typically include `client-certificate-data`, `client-key-data`, `token`, and `password` under the users array, as well as `certificate-authority-data` in the clusters array. This data can grant unfettered access to your Kubernetes API server.
How do I set the current context after merging?
By default, our tool adopts the `current-context` from the last loaded valid configuration file. If you need a different default context, you can easily change the `current-context` value at the top of the generated YAML file before saving.
What is the KUBECONFIG environment variable?
The `KUBECONFIG` environment variable is used by `kubectl` to find your configuration files. If not set, it defaults to `~/.kube/config`. You can set it to a single file path or a colon-separated list of paths to load multiple configs simultaneously.
How does kubectl use kubeconfig files?
When you execute a `kubectl` command, the CLI reads the kubeconfig file to determine the cluster's API endpoint, the necessary TLS certificates for secure communication, and the credentials to authenticate the request.
Related Tools
YAML Validator
Validate YAML files and catch indentation errors instantly with no uploads or backend processing.
Kubernetes ConfigMap Generator
Generate Kubernetes ConfigMap YAML manifests visually. Import from .env or JSON, add key-value pairs — 100% browser-based.
Kubernetes Secret Generator
Build Kubernetes Secret YAML with automatic Base64 encoding. Supports Opaque, Docker registry, TLS, and basic-auth types — 100% in your browser.
YAML ↔ JSON Converter
Convert YAML to JSON and JSON to YAML instantly in your browser. Resolves anchors and aliases with zero uploads.
Kubernetes Ingress Generator
Generate Kubernetes Ingress YAML manifests visually. Configure rules, TLS secrets, and service backends directly in your browser.