-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
68 lines (57 loc) · 2.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.PHONY: install add-new-identities uninstall
install:
# Create namespace
kubectl apply -f spire-namespace.yaml
# Then, install the server (order important)
kubectl apply -f server-account.yaml
kubectl apply -f spire-bundle-configmap.yaml
kubectl apply -f server-cluster-role.yaml
kubectl apply -f server-configmap.yaml
kubectl apply -f server-statefulset.yaml
kubectl apply -f server-service.yaml
# Then, install the SPIRE agent
kubectl apply -f agent-account.yaml
kubectl apply -f agent-cluster-role.yaml
kubectl apply -f agent-configmap.yaml
kubectl apply -f agent-daemonset.yaml
# Wait for the SPIRE server to be ready
kubectl wait -n spire -l statefulset.kubernetes.io/pod-name=spire-server-0 --for=condition=ready pod --timeout=-1s
# First, create a standard Node entry for the spire agent, this will be the parent identity for the other ones
kubectl exec -n spire spire-server-0 -- \
/opt/spire/bin/spire-server entry create \
-spiffeID spiffe://spiffe.cilium.io/ns/spire/sa/spire-agent \
-selector k8s_psat:agent_ns:spire \
-selector k8s_psat:agent_sa:spire-agent \
-node
# Then add the cilium-agent identity to the server (required for the delegated identity to work)
kubectl exec -n spire spire-server-0 -- \
/opt/spire/bin/spire-server entry create \
-spiffeID spiffe://spiffe.cilium.io/cilium-agent \
-parentID spiffe://spiffe.cilium.io/ns/spire/sa/spire-agent \
-selector k8s:ns:default \
-selector k8s:label:k8s-app:spiffetest
kubectl exec -n spire spire-server-0 -- \
/opt/spire/bin/spire-server entry create \
-spiffeID spiffe://spiffe.cilium.io/dclient \
-parentID spiffe://spiffe.cilium.io/ns/spire/sa/spire-agent \
-selector k8s:ns:kube-system \
-selector k8s:sa:cilium
kubectl exec -n spire spire-server-0 -- \
/opt/spire/bin/spire-server entry create \
-spiffeID spiffe://spiffe.cilium.io/cilium-operator \
-parentID spiffe://spiffe.cilium.io/ns/spire/sa/spire-agent \
-selector k8s:ns:kube-system \
-selector k8s:sa:cilium-operator
add-new-identities:
kubectl exec -n spire spire-server-0 -- \
/opt/spire/bin/spire-server entry create \
-spiffeID spiffe://spiffe.cilium.io/sclient \
-parentID spiffe://spiffe.cilium.io/dclient \
-selector cilium:mtls
kubectl exec -n spire spire-server-0 -- \
/opt/spire/bin/spire-server entry create \
-spiffeID spiffe://spiffe.cilium.io/id/1 \
-parentID spiffe://spiffe.cilium.io/dclient \
-selector cilium:mtls
uninstall:
kubectl delete -f spire-namespace.yaml