Version: 1.3.14

Certifai Remote Configuration

The code snippet provided below must be saved as a file. For example, save this script as Note that this script is intended to be run by a cluster administrator.

An example invocation of this script looks like ./ namespace, where namespace is the namespace where you installed the Certifai Enterprise instance.

#!/bin/bash -eu
# Extract the token and set up the kubeconfig file for the certifai cli
current_context=$(kubectl config current-context)
cluster_name=$(kubectl config view -o jsonpath='{.contexts[?( == "'$current_context'")].context.cluster}')
cluster_server=$(kubectl config view -o jsonpath='{.clusters[?( == "'$cluster_name'")].cluster.server}')
secret_name=$(kubectl get secrets -n $NAMESPACE --no-headers -o name | grep cortex-certifai-operator-token | head -1)
encoded_secret=$(kubectl get $secret_name -n $NAMESPACE -o jsonpath={.data.token})
decoded_secret=$(echo $encoded_secret | base64 -d --)
cluster_name_clean=$(echo "$cluster_name" | sed -e 's/[^A-Za-z0-9._-]/_/g')
echo "apiVersion: v1
- cluster:
insecure-skip-tls-verify: true
server: $cluster_server
name: $cluster_name
- context:
cluster: $cluster_name
user: certifai
name: $cluster_name
current-context: $cluster_name
kind: Config
preferences: {}
- name: certifai
token: $decoded_secret" > "${cluster_name_clean}.yaml"
echo "Updated $cluster_name_clean.yaml with access token."
echo Run the following command to configure the Certifai CLI:
echo certifai remote config -f "$cluster_name_clean.yaml" -n "$NAMESPACE"

The script creates a Kubernetes config file in the current directory for a default user named "certifai". This default user has the same permissions as the cortex-certifai-operator, and can be used by individuals or automated processes for interacting with your Cortex Certifai enterprise instance. After running the script, you can run the suggested command to configure the Certifai CLI as the default user.


# Run the above script to create the Kubeconfig file
$ ./ certifai
Updated <your-cluster>.yaml with access token.
Run the following command to configure Certifai CLI:
certifai remote config -f <your-cluster>.yaml -n certifai
# Configure the Certifai CLI
$ certifai remote config -f <your-cluster.yaml> -n certifai
Checking for access to Kubernetes cluster with context - <your-context>
Connection to cluster succeeded, found API - v1
Updating alias - default
Configuration updated from - <your-cluster>.yaml