Install kubectl 

In order to interact with the cluster it is needed to install the Kubernetes command-line tool "kubectl". 

The installation instructions are provided in the reference Kubernetes tools documentation.

Access the cluster

Once the cluster has been created successfully it is possible to retrieve the cluster certificates and config in order to connect to it.

  1. Create a directory to store the cluster certificate and config :
    $ mkdir -p ./k8s_config_dir
  2. Retrieve the cluster certificate and config
    $ openstack coe cluster config \
        --dir ./k8s_config_dir \
        --force \
        --output-certs 
        mycluster
    
    
  3. You can inspect the folder content to verify :
    $ ls -1 k8s_config_dir/
    ca.pem
    cert.pem
    config
    key.pem


You can then export the Kubernetes config in order to access the cluster via kubectl :

$ export KUBECONFIG=/<path>/k8s_config_dir/config


and then access the cluster via kubectl , e.g.

$ kubectl get nodes
NAME                                                         STATUS   ROLES           AGE   VERSION
mycluster-y3gdbps5sjfy-control-plane-trjgn          Ready    control-plane   94m   v1.32.1
mycluster-y3gdbps5sjfy-control-plane-df4jk          Ready    control-plane   87m   v1.32.1
mycluster-y3gdbps5sjfy-control-plane-hbwdz          Ready    control-plane   89m   v1.32.1
mycluster-y3gdbps5sjfy-default-worker-sdqnk-96vhd   Ready    <none>          91m   v1.32.1
mycluster-y3gdbps5sjfy-default-worker-sdqnk-pf37n   Ready    <none>          91m   v1.32.1


  • No labels