KUBECONFIG with pass
kubee will generate a kube config file dynamically if
- the
KUBECONFIGenv is not set - no default config file is found at
~/.kube/config - the command pass is found
It retrieves:
- the
clusterdata from thepasssecret manager. - the
userdata from thepasssecret manager. - the
namespacein this order:- command line option
KUBEE_CHART_NAMESPACEKUBEE_CONNECTION_NAMESPACE- otherwise
default
It’s a zero-trust connection tool.
KUBEE_CLUSTER_NAME: The cluster to connect (default todefault)KUBEE_CLUSTER_SERVER_IP: the server ip used by defaultKUBEE_USER_NAME: The user to connect with (default todefault)KUBEE_PASS_HOME: The directory where to storekubeepass information (default tokubee)KUBEE_CONNECTION_NAMESPACE: the connection namespace (default to the app namespace or to the KUBEE_DEFAULT_NAMESPACE)KUBEE_CHART_NAMESPACE: the chart namespace found in the chart values file.
How to create the secrets in path
Section titled “How to create the secrets in path”# Set the config where to extract the informationexport KUBECONFIG="$HOME/.kube/config"# The pass home directory (default to kubee)export KUBEE_PASS_HOME="kubee"
# Get the cluster and user name from the KUBECONFIG# or set your ownKUBEE_CLUSTER_NAME=$(kubectl config view --minify --raw --output 'jsonpath={$.clusters[0].name}')KUBEE_USER_NAME=$(kubectl config view --minify --raw --output 'jsonpath={$.users[0].name}')
# Store the clientkubectl config view --minify --raw --output 'jsonpath={$.users[0].client-certificate-data}' | pass insert -m "$KUBEE_PASS_HOME/users/$KUBEE_USER_NAME/client-certificate-data"kubectl config view --minify --raw --output 'jsonpath={$.users[0].client-key-data}' | pass insert -m "$KUBEE_PASS_HOME/users/$KUBEE_USER_NAME/client-key-data"
# Store the certificate authoritykubectl config view --minify --raw --output 'jsonpath={$.clusters[0].certificate-authority-data}' | pass insert -m "$KUBEE_PASS_HOME/clusters/$KUBEE_CLUSTER_NAME/certificate-authority-data"# The server URI is derived from KUBEE_CLUSTER_SERVER_IPHow to see the generated config file
Section titled “How to see the generated config file”kubee kubectl config viewHow to test
Section titled “How to test”kubee kubectl cluster-info