k8s/000-scripts/vault-k8s-auth-endpoint.sh
2022-07-02 14:41:57 -04:00

12 lines
337 B
Bash
Executable file

#!/bin/bash
HOST_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
kubectl config view --raw --minify --flatten --output='jsonpath={.clusters[].cluster.certificate-authority-data}' | base64 --decode > ca.crt
vault write auth/kubernetes/config \
kubernetes_host=https://${HOST_IP}:6443 \
kubernetes_ca_cert=@ca.crt
rm ca.crt