kubectl bridge plugin
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed
- Status: Experiment
The kubectl bridge plugin runs the Bridge UI and API on your own machine. The plugin acts as your
kubeconfig identity, the same way kubectl does. Client certificate, exec, OIDC, and token
credentials all work. You do not create a service account or paste a token.
Use the plugin to:
- Open the Bridge UI.
- Migrate a
GitLabresource to aGitLabCore.
The plugin writes the custom resources only. To deploy the instances you configure, an Operator with Bridge enabled must run in the cluster. For more information, see Try Bridge in a development environment.
Install the plugin
No release ships a binary of the plugin. Build it from the source of the GitLab Operator.
Prerequisites:
- Git, and
kubectl. - Go, Node.js with npm, and Task. The project pins their versions in
mise.toml.
To install the plugin:
Clone the GitLab Operator project:
git clone https://gitlab.com/gitlab-org/cloud-native/gitlab-operator.git cd gitlab-operatorCheck out the branch of the Operator image you run. For the
latest-bridgeimage, stay on the default branch.Optional. If you use mise, install the pinned tool versions:
mise installBuild and install the plugin:
task install-kubectl-pluginThe task builds the UI, then installs the
kubectl-bridgebinary withgo install. The binary goes to$GOBINwhen it is set, and to$(go env GOPATH)/binotherwise. The task prints the path.Add that directory to your
PATH, becausekubectlfinds plugins on thePATH. For example, add this line to your shell profile:export PATH="$(go env GOPATH)/bin:$PATH"Verify that
kubectlfinds the plugin:kubectl plugin list | grep kubectl-bridge
To update the plugin, pull the branch and run task install-kubectl-plugin again.
Start the Bridge UI
Prerequisites:
- Your kubeconfig identity has the verbs you need on
gitlabcores.apps.gitlab.com,siphons.apps.gitlab.com, andorbits.apps.gitlab.com. To create, edit, and delete instances, grantget,list,watch,create,update,patch, anddelete. - Optional. To choose a namespace from a list in the form, your identity has
liston namespaces. To create a namespace from the form, it also hascreateon namespaces.
To start the Bridge UI:
Run the plugin against your current kubeconfig context:
kubectl bridgeThe plugin prints the identity it acts as and the URL, and opens the URL in your browser. The header of the UI shows Local kubeconfig identity. For the API documentation, open
/docson the same URL.When you are done, stop the plugin with Control+C.
The plugin listens on 127.0.0.1:8090. When that port is busy, the plugin picks a free port and
prints it.
To use another context on another port, without opening a browser:
kubectl bridge --context <your_context> --port 9000 --no-openFor all options, run kubectl bridge --help.
Reach the plugin from another host
The plugin does not authenticate requests. Anyone who reaches the port acts with the permissions of your kubeconfig. Bind an address other than loopback only on a network you trust.
To run the plugin in a container or on a remote host, bind a routable address with --address.
The plugin prints a warning when the address is not loopback.
The plugin answers 403 to an API request addressed to a host name it does not expect. It accepts
loopback names, such as localhost, and the bind address. To reach the plugin under another name,
such as a DNS entry or a container host name, pass the name to --accept-hosts:
kubectl bridge --address 0.0.0.0 --accept-hosts bridge.example.com --no-openThe plugin also answers 403 to an API request that the browser marks as sent from another site.
Clients that are not browsers, such as curl, are not affected.