https://www.youtube.com/watch?v=MuYmhc4mJHI
Prerequisites:
- Kubernetes cluster
- Istio 1.16.1
Make sure you update the YAML files with your own cluster name and trust domain you want to use.
-
Update the
clusterName
andtrustDomain
fields inspire-controller-manager-config.yaml
-
Create the namespace and deploy the CSI driver, CRDs and the controll manager configuration and webhook:
demo/deploy-prereqs.sh
-
Open
spire-server.yaml
and update the following values in thespire-server
ConfigMap resource:trust_domain
ca_subject
- cluster name in the
k8s_psat
NodeAttestor
-
Deploy the SPIRE server:
kubectl apply -f demo/spire-server.yaml
-
Open
spire-agent.yaml
and update the following values in thespire-agent
ConfigMap resource:trust_domain
- cluster name in the
k8s_psat
NodeAttestor
-
Deploy the SPIRE agent:
kubectl apply -f demo/spire-agent.yaml
- You can check the registration entries for SPIRE agents from the
spire-server
container:
SPIRE_SERVER_POD=$(kubectl get pod -l app=spire-server -n spire -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it spire-server-0 -n spire -c spire-server -- ./bin/spire-server agent list
- Deploy the
clusterspiffeid.yaml
file:
kubectl apply -f demo/clusterspiffeid.yaml
- Open
istio-spire-config.yaml
and update thetrustDomain
and theclusterName
fields, then install Istio:
istioctl install -f demo/istio-spire-config.yaml
- We can check the list of registration entries:
SPIRE_SERVER_POD=$(kubectl get pod -l app=spire-server -n spire -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it spire-server-0 -n spire -c spire-server -- ./bin/spire-server entry show
- Label the default namespace for Istio sidecar injection:
kubectl label ns default istio-injection=enabled
- Deploy the sleep workload (note that you have to add the annotation if you're using a different workload/YAML):
kubectl apply -f demo/sleep-spire.yaml
- Retrieve the sleep workload certificate:
SLEEP_POD=$(kubectl get pod -l app=sleep -o jsonpath="{.items[0].metadata.name}")
istioctl proxy-config secret $SLEEP_POD -o json | jq -r '.dynamicActiveSecrets[0].secret.tlsCertificate.certificateChain.inlineBytes' | base64 --decode > sleep.pem
- You can use
openssl
to inspect it:
openssl x509 -in sleep.pem -text
- SPIFFE spec - https://github.com/spiffe/spiffe/blob/main/standards/SPIFFE.md
- Official SPIFFE docs - https://spiffe.io/docs/latest/spiffe-about/overview/
- SPIRE architecture & components - https://spiffe.io/docs/latest/spire-about/spire-concepts
- Scaling SPIRE - https://spiffe.io/docs/latest/planning/scaling_spire
- Istio cert management - https://istio.io/latest/docs/concepts/security/#pki
- Istio SPIRE integration - https://istio.io/latest/docs/ops/integrations/spire