Kubernetes / OpenLens setup
You can only do this with sufficient access rights - ask Innovations team or Bratislava IT department if connecting to k8s infrastructure is relevant to you.
Install Requirements
- Install kubectl based
brew install kubectl
or based on you platform you can follow https://kubernetes.io/docs/tasks/tools/ (opens in a new tab) - Download and install vsphere tanzu plugin here (opens in a new tab), you need to be connected on cable or through VPN to magistrate network
- Windows - copy
kubectl
andkubectl-vsphere
toc:/windows/system32
(needed admin rights) otherwisekubectl vsphere login
commands will not work
- Windows - copy
- Install kubeseal (opens in a new tab)
brew install kubeseal
(apt install kubeseal
), a tool for generating secrets - Download and install Kubernetes OpenLens (opens in a new tab)
brew install openlens
, a GUI tool for easier management of cluster deployments- Also note the extensions section (opens in a new tab) to add the Node/Pod menu extension.
- If you prefer command line environments there is also a tool called k9s (opens in a new tab), which can serve as alternative to OpenLens.
Login
- be connected on cable or through VPN to magistrate, where username is your email.
- run kubectl login commands
- main login
kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify -u {{username}}
- to login through Windows you need to set password
export KUBECTL_VSPHERE_PASSWORD={{password}}
- to login through Windows you need to set password
- logins to clusters
kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-name=tkg-innov-dev -u {{username}}
kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-name=tkg-innov-staging -u {{username}}
kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-name=tkg-innov-prod -u {{username}}
kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-name=tkg-master -u {{username}}
(optional, you don't need this, its only master cluster)
- main login
- open OpenLens and you should see clusters
Tips & Tricks
If you are running reasonable command line environment you can create aliases for these logins.
For *nix based command line environment you can add these to your ~/.bash_aliases
or ~/.bashrc
. For example:
# k8 login aliases
alias k8dev='kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-name=tkg-innov-dev -u {{username}} && kubectl config use-context tkg-innov-dev'
alias k8stage='kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-name=tkg-innov-staging -u {{username}} && kubectl config use-context tkg-innov-staging'
alias k8staging='k8stage'
alias k8prod='kubectl vsphere login --server=10.10.10.1 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-name=tkg-innov-prod -u {{username}} && kubectl config use-context tkg-innov-prod'
These will also set a correct config context to use for our clusters. To apply changes re-log to your console or called (any relevant equivalent to) source ~/.bashrc
. After this, you can log in just by running k8dev
. Note, if you don't have $KUBECTL_VSPHERE_PASSWORD
environment variable set it will ask you for your NT password.