kctxsync is a command-line tool to sync certificate and key data from a remote Kubernetes cluster's kubeconfig to your local kubeconfig.
MIT License
kctxsync
is a command-line tool designed to synchronize the certificate and key data from a remote Kubernetes cluster's kubeconfig file to your local kubeconfig. It is particularly useful for updating the local kubeconfig when certificates or keys have changed in the remote cluster, ensuring that your local environment is always in sync with the remote server.
~/.kube/config
).To sync the local kubeconfig with the remote server's kubeconfig, use the following command:
kctxsync sync <context_name>
kctxsync sync <context_name> --config /path/to/kubeconfig --user <ssh_user>
If you do not provide a context and there are multiple contexts in the kubeconfig, an error will prompt you to select a context explicitly.
You can sync all the contexts in your local kubeconfig with the remote server by using the --all flag:
kctxsync sync --all
If you need to connect to a specific SSH host (instead of using the server from the kubeconfig), you can use the --ssh flag:
kctxsync sync <context_name> --ssh <ssh_host>
This will allow you to connect to a specific SSH host, overriding the server defined in the kubeconfig for the context.
kctxsync sync dev --user ubuntu --ssh my.remote.server.com
This will connect to the specified remote server my.remote.server.com
using the SSH user ubuntu
, fetch the kubeconfig file, and sync the context dev from the remote kubeconfig to your local kubeconfig.
brew install vvrnv/tap/kctxsync
go install github.com/vvrnv/kctxsync@latest