Categories
Linux openstack Virtualization

Kubectl and OpenStack kubernetes

When trying to get first access to an OpenStack based kubernetes cluster, you’ll first need to create a correct ~/.kube/config file.

OpenStack however only provides you with a collection of files you need to assemble yourself:

  • <Clustername>_config.txt
  • <Clustername>_ca.pem
  • <Clustername>_cert.pem
  • <Clustername>_key.pem

However you’ll need all that components in the right place in a single file.

Here’s a short version of how to do that (in our example the <Clustername> is simply “Test”):

linux # mv Test_config.txt ~/.kube/config
linux # kubectl config set-cluster Test --certificate-authority=Test_ca.pem  --embed-certs=true
Cluster "Test" set.
linux # kubectl config set-credentials Test  --client-key=Test_key.pem  --client-certificate=Test_cert.pem --embed-certs=true
User "OpenWebUI" set.

These commands will integrate the CA and the user certificate and key into the base configuration. If everything went according to plan you should now be able to do:

linux # kubectl get services
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.254.0.1   <none>        443/TCP   11d

Leave a Reply

Your email address will not be published. Required fields are marked *