Converting certificate files to certificate data fields

Kubernetes import is in private beta at the moment

if you are interested in testing this out, please reach out to the support team, and we will enable it on your account

Hava does not support accessing external files within your kubeconfig for authentication using client certificates. Luckily, it's a simple process to convert these to data fields that can be entered directly into your configuration.

The fields that will need to be converted are:

  • certificate-authority to become certificate-authority-data

  • client-certificate to become client-certificate-data

  • client-key to become client-key-data

Finding and converting the files

For this example we have the following kubeconfig using local certificates files.

apiVersion: v1
kind: Config
preferences: {}
clusters:
  - cluster:
      certificate-authority: /Users/example/ca.crt
      server: https://kubeserver:8443
    name: kube
contexts:
  - context:
      cluster: kube
      user: kube
    name: kube
users:
  - name: kube
    user:
      client-certificate: /Users/example/client.crt
      client-key: /Users/example/client.key

For each of these external files we need to convert them to base64 and then update the configuration with the base64 string.

Here's an example using the certificate authority file:

Linux and MacOS

cat /Users/example/ca.crt | base64

Windows

certutil -f -encode "c:/Users/example/ca.crt" "output-file"

Update the config to use the new values

Once you've got the base64 data for all 3 values you can update the config file.

apiVersion: v1
kind: Config
preferences: {}
clusters:
  - cluster:
      certificate-authority-data: <base64 ca.crt>
      server: https://kubeserver:8443
    name: kube
contexts:
  - context:
      cluster: kube
      user: kube
    name: kube
users:
  - name: kube
    user:
      client-certificate-data: <base64 client.crt>
      client-key-data: <base64 client.key>

Your configuration is now ready to import into Hava to connect and display your Kubernetes clusters!

Last updated