Kubectl
The Kubernetes command line tool kubectl allows you to control your cluster resources.
Installation
Reference
Prerequisites
- A shell terminal
- A browser access to authenticate using Kubelogin from the computer where kubectl will be installed.
if you don’t have access to a browser from the computer where kubectl will be installed (example, headless server), you can install it on a computer which does and copy the
.kube/config
once you have been authenticated
kubectl
Example of an installation on a linux computer (more details on the official documentation).
Bash completion (recommended)
Authentication
The OIDC authentication kubectl plugin kubelogin will ensure the SSO login to the h8lio identity provider.
- Get the kubectl config file from your h8l.io cluster: on the dashboard clic on the name of the cluster > “Config File”
- Create or merge with your existing
[HOME]/.kube/config
with the above file content - Install kubelogin plugin
- https://github.com/int128/kubelogin#getting-started
- you can also download the latest binary releases and put it beside your kubectl
- Test your authentication by running
kubelogin
. This should open your browser to authenticate to h8lio once you authorize the access. This should be done only once as the authentication provide a refresh token to renew the authentication as necessary
.kube/config template
The following code block shows the template of the config
file used to authenticate to the h8lio cluster. You need to replace:
[username]
: name of the user, example:john.doe
. It’s not necessary an h8lio user, only the kube-login plugin will need an existing member to authenticate.[namesace]
: your namespace (ie. h8lio cluster:[domain]-[cluster]
), example:demo-prod
if you already have a .kube/config file, you can merge it by adding to it the item in the above
clusters
,contexts
andusers
sections (and usekubectx
to switch between contexts)
Multiple Context and/or Namespaces (optional)
If you have multiple Kubernetes Clusters and/or Namespaces, we recommend to install respectively the command tools kubectx
and kubens
to easily switch between them.
Please refer to the project documentation.
Usage
Check the reference documentation of the kubectl command line: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
Some useful commands:
Going further…
One kubectl installed and configured on your local machine or server to access your h8lio clusters, you will be able to install and use more tools and applications as: