kubectl
as with any other Kubernetes cluster, with the caveat that you must use the kubeconfig
file that you download from Omni, and have the OIDC plug-in installed for your kubectl
.
All Kubernetes kubectl
commands are routed through the API endpoint created by Omni, and Omni validates access through the configured OIDC provider or other user authorization mechanism. This ensures your Kubernetes cluster is safe - unlike other systems, mere possession of a kubeconfig
grants no access - the user also has be valid in the configured authentication system of Omni.
Download the KubeConfig file
Navigate to the clusters page by clicking on the âClustersâ button in the sidebar. Click on the cluster and then click âDownload kubeconfigâ from the cluster dashboard on the right. The downloaded file will reflect the name of the cluster.Install the OIDC plug in
Install theoidc-login
plugin per the official documentation: https://github.com/int128/kubelogin#getting-started
Access the cluster with kubectl
kubectl
command to query a cluster, a browser window will open requiring you to authenticate with your identity provider.
If you get a message error: unknown command "oidc-login" for "kubectl" Unable to connect to the server
then you need to install the oidc-login plugin as noted above, and ensure it is in your $PATH.
Authentication for
omnictl
, talosctl
, and kubectl
will last for 8 hours. After 8 hours you will need to re-authenticate each tool for your environment.Switching between users when authenticating to the same cluster
If you have multiple contexts in your kubeconfig(s) authenticating to the same cluster (in the same Omni instance), switching between these contexts does not switch the authenticated user. This is a known limitation of the OIDC-based login we use - it uses the existing logged-in user, as their auth token is the already cached for that cluster. To work around that, when you want to switch to another user, you need to clear the authentication cache first. To do this, run one of the following:kubectl
command you run should trigger the OIDC login flow again, where you can authenticate as the user you need via Switch User
option.
OIDC authentication over SSH
If you need to usekubectl
on a remote host over SSH you have two options.
Download kubeconfig
with --grant-type=authcode-keyboard
To get started, you first need to download both omnictl and omniconfig. Once installed, you can use omnictl
to download the configuration with the following command:
KUBECONFIG
environment variable.
When using this configuration, the process will not attempt to open a browser automatically. Instead, it will present you with a URL and prompt you to enter a one-time code:
Download the regular kubeconfig
and do port-forwarding
To do that you can tunnel the ports over SSH when you connect to the host. This command will open a tunnel using the default ports oidc-login
attempts to use.
~/.ssh/config
file to contain the following lines for the host.
--skip-open-browser
in your $KUBECONFIG
file.