@@ -834,6 +834,17 @@ Cluster ID: 89ccbeb4-8af1-7dca-77bb-38f39c423a39
834
834
High-Availability Enabled: false
835
835
```
836
836
837
+ . Authenticate against Vault using the root token from the output when starting vault:
838
+ +
839
+ ```
840
+ vault auth
841
+ Token (will be hidden):
842
+ Successfully authenticated! You are now logged in.
843
+ token: 4e93b3c6-c459-f166-e7e9-6c48044cfdb6
844
+ token_duration: 0
845
+ token_policies: [root]
846
+ ```
847
+
837
848
=== Configure Kubernetes Service Account
838
849
839
850
. Create the service account to verify service account token during login:
@@ -860,6 +871,10 @@ Service account token, Kubernetes API server address and the certificate used to
860
871
kubectl get secret \
861
872
$(kubectl get serviceaccount vault-reviewer -o jsonpath={.secrets[0].name}) \
862
873
-o jsonpath={.data.token} | base64 -D -
874
+ export REVIEWER_TOKEN=$(kubectl get secret \
875
+ $(kubectl get serviceaccount vault-reviewer \
876
+ -o jsonpath={.secrets[0].name}) -o jsonpath={.data.token} | base64 -D -)
877
+ && echo $REVIEWER_TOKEN
863
878
eyJ . . . reg
864
879
865
880
. Get the API server address:
@@ -888,7 +903,7 @@ This is the address of API servers currently configured. The first one is for th
888
903
.. Configure the auth backend:
889
904
890
905
$ vault write auth/kubernetes/config \
891
- token_reviewer_jwt=<service-account-token> \
906
+ token_reviewer_jwt=$REVIEWER_TOKEN \
892
907
kubernetes_host=<api-server> \
893
908
kubernetes_ca_cert=@~/.kube/kops.crt
894
909
+
@@ -960,9 +975,17 @@ More details about the Docker image used in the Pod is at https://github.com/aru
960
975
image: arungupta/vault-kubernetes:latest
961
976
env:
962
977
- name: VAULT_ADDR
963
- value: http://ec2-54-237-223-40.compute-1.amazonaws.com:8200
978
+ valueFrom:
979
+ configMapKeyRef:
980
+ name: vault
981
+ key: address
964
982
restartPolicy: Never
965
983
984
+ . Create the ConfigMap:
985
+
986
+ $ kubectl create configmap vault --from-literal=address=$VAULT_ADDR
987
+ configmap "vault" created
988
+
966
989
. Deploy the Pod:
967
990
968
991
$ kubectl apply -f templates/pod-vault.yaml
0 commit comments