From 15cfa5b48e657b0193b9a9c14b59d6a5ff10f03c Mon Sep 17 00:00:00 2001 From: Asara Date: Sat, 2 Jul 2022 14:37:33 -0400 Subject: [PATCH] Add k8s auth endpoint to vault --- 000-scripts/vault-k8s-auth-endpoint.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 000-scripts/vault-k8s-auth-endpoint.sh diff --git a/000-scripts/vault-k8s-auth-endpoint.sh b/000-scripts/vault-k8s-auth-endpoint.sh new file mode 100755 index 0000000..e74778a --- /dev/null +++ b/000-scripts/vault-k8s-auth-endpoint.sh @@ -0,0 +1,10 @@ +#!/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