Skip to content

Commit d10152b

Browse files
Update Blog “federating-spire-on-hpe-greenlake-for-private-cloud-enterprise”
1 parent 48ddfe7 commit d10152b

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

content/blog/federating-spire-on-hpe-greenlake-for-private-cloud-enterprise.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ This patch will register your ingress-gateway pod into the server.
120120
kubectl patch deployment istio-ingressgateway -n istio-system -p '{"spec":{"template":{"metadata":{"labels":{"spiffe.io/spire-managed-identity": "true"}}}}}'
121121
```
122122

123-
### 2.3.3 After patching, confirm the working of your ingress-gateway pod, istiod and all their containers. 
123+
### 2.3.3 Check your work
124+
125+
After patching, confirm that your ingress-gateway pod, istiod and all their containers work.
124126

125127
```shellsession
126128
Cluster1:~ # kubectl get po -n istio-system
@@ -138,17 +140,17 @@ istiod-d5bc8669c-thbpj 1/1 Running 0 37d
138140

139141
# Step 3. Federating SPIRE
140142

141-
## 3.1 Expose SPIRE server bundle endpoint
143+
## 3.1 Expose SPIRE server bundle endpoint
142144

143145
Assign an external IP to your spire-server-bundle-endpoint service on each cluster.  
144146

145-
SPIFFE ( *Secure Production Identity Framework For Everyone*) is a specification for implementing identity for workloads, and SPIRE is the code that implements this specification in practice. A SPIFFE bundle is a resource that contains the public key material needed to authenticate credentials from a particular trust domain. A SPIFFE bundle endpoint is a resource (represented by a URL) that serves a copy of a SPIFFE bundle for a trust domain. SPIFFE control planes may both expose and consume these endpoints to transfer bundles between themselves, thereby achieving federation. We use the SPIRE server to host the “spire-server-bundle-endpoint” service that serves the SPIFFE bundle to an external Spire agent of a different trust domain.  
147+
SPIFFE (*Secure Production Identity Framework For Everyone*) is a specification for implementing identity for workloads, and SPIRE is the code that implements this specification in practice. A SPIFFE bundle is a resource that contains the public key material needed to authenticate credentials from a particular trust domain. A SPIFFE bundle endpoint is a resource (represented by a URL) that serves a copy of a SPIFFE bundle for a trust domain. SPIFFE control planes may both expose and consume these endpoints to transfer bundles between themselves, thereby achieving federation. The SPIRE server is used to host the “spire-server-bundle-endpoint” service that serves the SPIFFE bundle to an external Spire agent of a different trust domain.  
146148

147-
We use MetalLB to assign the IP for this service. MetalLB hooks into your Kubernetes cluster and provides a network load-balancer implementation. In short, it allows you to create Kubernetes services of type LoadBalancer in clusters that don’t run on a cloud provider, and thus cannot simply hook into paid products to provide load balancers. 
149+
MetalLB is used to assign the IP for this service. MetalLB hooks into your Kubernetes cluster and provides a network load-balancer implementation. In short, it allows you to create Kubernetes services of type LoadBalancer in clusters that don’t run on a cloud provider, and thus cannot simply hook into paid products to provide load balancers. 
148150

149151
Follow this [link](https://metallb.universe.tf/configuration/_advanced_ipaddresspool_configuration/#controlling-automatic-address-allocation) to set up an automatic address allocation for all services that have type external IP. 
150152

151-
Ours looks something like this: 
153+
The configuration should now look something like this:
152154

153155
```shellsession
154156
Cluster1:~ # kubectl get svc -n spire
@@ -170,7 +172,7 @@ spire-server-bundle-endpoint LoadBalancer 10.104.151.184 172.16
170172

171173
The Cluster Federated Trust Domain CRD is used to federate the clusters with each other.  
172174

173-
It requires the following configurations: 
175+
It requires the following federation configurations: 
174176

175177
### Cluster Federated Trust Domain:
176178

@@ -201,7 +203,7 @@ Cluster2:~ # kubectl exec -n spire -c spire-server deployment/spire-server -- /o
201203

202204
Doing a cat command of the bundles reveals the keys to be copied into the trust domain bundle field.  
203205

204-
After the Bundle endpoint URL and the TrustDomainBundle fields are configured and applied, check the status of the spire pods to make sure they are running and check the logs of the spire-server to verify successful federation.
206+
After the Bundle endpoint URL and the TrustDomainBundle fields are configured and applied, check the status of the SPIRE pods to make sure they are running and check the logs of the spire-server to verify successful federation.
205207

206208
```shellsession
207209
Cluster1:~ # kubectl logs -n spire -c spire-server spire-server-574474c7dc-gbzl6
@@ -215,27 +217,27 @@ Cluster2:~ # kubectl logs -n spire -c spire-server spire-server-574474c7dc-2bfcx
215217

216218
![Cluster-2 Logs](/img/table4.png)
217219

218-
# Step 4. Deploying a sample application :
220+
# Step 4. Deploying a sample application
219221

220-
Now that SPIRE is federated and communication across clusters can be facilitated, let us deploy a sample application that verifies this functionality.   
222+
Now that SPIRE is federated and communication across clusters can be facilitated, here's how you can deploy a sample application that verifies this functionality.   
221223

222224
## 4.1 Deploy a resource in Cluster-1
223225

224-
In Cluster 1, apply a new ClusterSpiffeID called federated that registers resources with the label **spiffe.io/spire-managed-identity=curl-greeter** that can be federated with cluster2. Create a resource called curl-greeter that has the label: **spiffe.io/spire-managed-identity=curl-greeter** and annotation: **inject.istio.io/templates=sidecar, spire** 
226+
In Cluster 1, apply a new ClusterSpiffeID called ***federated*** that registers resources with the label **spiffe.io/spire-managed-identity=curl-greeter** that can be federated with cluster2. Create a resource called ***curl-greeter*** that has the label: **spiffe.io/spire-managed-identity=curl-greeter** and annotation: **inject.istio.io/templates=sidecar, spire** 
225227

226228
```shellsession
227229
kubectl run curl-greeter --image=radial/busyboxplus:curl --labels="spiffe.io/spire-managed-identity=curl-greeter" --overrides='{ "apiVersion": "v1", "spec": { "template": {"metadata": {"annotations": { "inject.istio.io/templates":"sidecar,spire" } } }}}' -i --tty
228230
```
229231

230232
## 4.2 Deploy Bookinfo Sample Application in Cluster-2
231233

232-
In Cluster 2, apply a new ClusterSpiffeID called federated that registers resources with the label **spiffe.io/spire-managed-identity=spire** that can be federated with cluster1. Apply the bookinfo sample application manifest. 
234+
In Cluster 2, apply a new ClusterSpiffeID called ***federated*** that registers resources with the label **spiffe.io/spire-managed-identity=spire** that can be federated with cluster1. Apply the bookinfo sample application manifest. 
233235

234236
```shellsession
235237
kubectl apply -f services/istio/release-1.17/bookinfo.yaml
236238
```
237239

238-
## 4.3 Check if all the resources created are up and running:
240+
## 4.3 Check if all the resources created are up and running
239241

240242
```shellsession
241243
Cluster1:~ # kubectl get po
@@ -260,7 +262,7 @@ reviews-v3-6dbfcc6d89-zn9tw       2/2     Running   0      
260262

261263
## 4.4 Check that the workload identity was issued by SPIRE
262264

263-
Spire Certificate at Curl-Greeter 
265+
SPIRE certificate at Curl-Greeter 
264266

265267
```shellsession
266268
Cluster1:~ # istioctl proxy-config secret curl-greeter -o json | jq -r \
@@ -274,7 +276,9 @@ Cluster1:~ # openssl x509 -in chain.pem -text | grep SPIRE
274276

275277
*Note: Similarly, certificates for other pods can be checked.* 
276278

277-
## 4.5 Create a secret to hold bookinfo product page credentials like this: 
279+
## 4.5 Create a secret
280+
281+
Create a secret to hold bookinfo product page credentials like this: 
278282

279283
```shellsession
280284
kubectl create -n istio-system secret generic bookinfo-credential \ 
@@ -302,13 +306,13 @@ kubectl exec -n spire -c spire-server deployment/spire-server -- /opt/spire/bin/
302306

303307
*Note: Copy the ca cert under the cluster1.demo section into a new file bookinfo.ca.cert.* 
304308

305-
Apply the gateway configuration for the bookinfo application found here: (It uses the istio-ingress gateway) 
309+
Apply the gateway configuration for the bookinfo application found [here](https://github.com/cxteamtrials/caas-trials-content/blob/main/services/istio/release-1.17/samples/bookinfo-gateway.yaml): (It uses the istio-ingress gateway) 
306310

307311
```shellsession
308312
kubectl apply -f services/istio/release-1.17/bookinto-gateway.yaml
309313
```
310314

311-
## 4.6 Generate traffic to the sample application on cluster2 from the curl greeter on cluster 1:  
315+
## 4.6 Generate traffic to the sample application on cluster2 from the curl greeter on cluster 1
312316

313317
Curl Command at Cluster 1 (IP addr: istio-ingress-gateway external ip) 
314318

@@ -430,12 +434,12 @@ kubectl exec -n spire -c spire-server deployment/spire-server -- /opt/spire/bin/
430434

431435
*Note: Copy the ca cert under the cluster2.demo section into a new file bookinfo.ca.cert.* 
432436

433-
## 4.7 Visualize using Service Mesh
437+
## 4.7 Visualize using Service Mesh
434438

435-
Using the Kiali dashboard, observing the graphs of generated traffic. 
439+
Using the Kiali dashboard, observe the graphs of generated traffic. 
436440

437441
The graph below shows services communication, and the locks symbolize mTls protocol. 
438442

439443
![mTLS Graph](/img/mtls.png)
440444

441-
The goal of this blog was to guide you through federating SPIRE across two Kubernetes clusters deployed on HPE GreenLake for Private Cloud Enterprise by creating a cluster federated trust domain and federated ClusterSpiffeIDs for your sample application workloads as well as to help you visualize your service mesh through Kiali Dashboard.
445+
The goal of this blog post was to guide you through federating SPIRE across two Kubernetes clusters deployed on HPE GreenLake for Private Cloud Enterprise. It shows you how to do this by creating a cluster federated trust domain and federated ClusterSpiffeIDs for your sample application workloads and **then helps** you visualize your service mesh through Kiali Dashboard

0 commit comments

Comments
 (0)