Skip to content

Commit e45912c

Browse files
committed
Update Blog “integrating-istio-and-spire”
1 parent e339324 commit e45912c

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

content/blog/integrating-istio-and-spire.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ kubectl apply -f spire-quickstart.yaml
6868

6969
This will install SPIRE into your cluster, along with two additional components: the SPIFFE CSI Driver and the SPIRE Kubernetes **Controller manager** which facilitate the registration of workloads and establishment of federation relationships.
7070

71-
Verify installation of SPIRE by checking if all pods are running and containers within them are up. Specifically, you are looking for agent and SPIRE server.
71+
Verify installation of SPIRE by checking if all pods are running and containers within them are up. Specifically, you should look for the agent and SPIRE server.
7272

73-
**Note:** Number of agents depends on number of nodes you are working with. Here we are working with three worker nodes, so three agents are assigned for each node.
73+
**Note:** The number of agents depends on number of nodes you are working with. Here, we are working with three worker nodes, so three agents are assigned for each node.
7474

7575
Use the command given below, and you will get the output as shown.
7676

@@ -87,27 +87,27 @@ spire-server-574474c7dc-42kln 2/2 Running 4 (4d1h ago) 31d
8787

8888
#### Download the latest release:
8989

90-
You can download the latest release using the official Istio repository or just copy the following command, which would do the same for you.
90+
You can download the latest release using the official Istio repository or just copy the following command (which would do the same thing for you).
9191

9292
```shellsession
9393
curl -L https://istio.io/downloadIstio | sh -
9494
```
9595

96-
For details reach out to **[ISTIO download page](https://istio.io/latest/docs/setup/getting-started/#download)**.
96+
For details, reach out to **[ISTIO download page](https://istio.io/latest/docs/setup/getting-started/#download)**.
9797

98-
cd into the Istio directory and set the path by command:
98+
Get into the Istio directory and set the path by command:
9999

100100
```shellsession
101101
export PATH=$PWD/bin:$PATH
102102
```
103103

104-
After exporting get out of directory.
104+
After exporting, get out of directory.
105105

106106
```shellsession
107107
cd ..
108108
```
109109

110-
**Note:** In the future, a case might occur when your cluster does not recognize istioctl. In this case, export the path again after getting into istio directory.
110+
**Note:** In the future, a case might occur when your cluster does not recognize istioctl. In this case, export the path again after getting into the Istio directory.
111111

112112
#### **Install Istio with patches:**
113113

@@ -127,7 +127,7 @@ This will share the spiffe-csi-driver with the Ingress Gateway and the sidecars
127127

128128
![](/img/patch-error-ingress.jpg)
129129

130-
For patching, the first step is to get and apply one of SPIRE controller manager’s [CRD(Custom Resource Definition)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) ClusterSPIFFEID. It is a cluster-wide resource used to register workloads with SPIRE. The ClusterSPIFFEID can target all workloads in the cluster or can be optionally scoped to specific pods or namespaces via label selectors.
130+
For patching, the first step is to get and apply one of SPIRE controller manager’s [CRD (Custom Resource Definition)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) ClusterSPIFFEID. It is a cluster-wide resource used to register workloads with SPIRE. The ClusterSPIFFEID can target all workloads in the cluster or can be optionally scoped to specific pods or namespaces via label selectors.
131131

132132
Create a ClusterSPIFFEID CRD to generate registration entries in SPIRE server for all workloads with the label **`spiffe.io/spire-managed-identity: true`**.
133133

@@ -137,33 +137,33 @@ This will share the spiffe-csi-driver with the Ingress Gateway and the sidecars
137137
kubectl apply -f cluster-spiffeID-crd.yaml
138138
```
139139

140-
**Note:** You can create your own custom clusterSPIFFEID CRD with your own match label and own selector. For now, we have created simple CRD with one pod selector and one match label.
140+
**Note:** You can create your own custom clusterSPIFFEID CRD with your own match label and own selector. For now, we have created a simple CRD with one pod selector and one match label.
141141

142-
Now simply patch the ingress-gateway with spiffe.io/spire managed-identity: true label.
142+
Now, simply patch the ingress-gateway with spiffe.io/spire managed-identity: true label.
143143

144144
This will register your ingress-gateway pod into the server.
145145

146146
```shellsession
147147
kubectl patch deployment istio-ingressgateway -n istio-system -p '{"spec":{"template":{"metadata":{"labels":{"spiffe.io/spire-managed-identity": "true"}}}}}'
148148
```
149149

150-
After patching, confirm the working of your ingress-gateway pod, istiod, and all their containers.
150+
After patching, confirm that your ingress-gateway pod, istiod, and all their containers work.
151151

152152
## Step 4: Deploying Sample Application
153153

154154
Now that our SPIRE and Istio are integrated, the identities to workloads must be issued by SPIRE.
155155

156-
For our case, we will create a namespace “bookinfo” and will add a label **“spiffe.io/spire-managed-identity: true”** to it, then we will create a new ClusterSPIFFEID CRD with **namespace selector** with match label as “spiffe.io/spire-managed-identity: true.”
156+
For our case, we will create a namespace “bookinfo” and will add a label **“spiffe.io/spire-managed-identity: true”** to it. Then, we will create a new ClusterSPIFFEID CRD with **namespace selector** with match label as “spiffe.io/spire-managed-identity: true.”
157157

158-
Now when the new workload is added to this namespace or any other namespace which has the label mentioned above, then automatically it will get registered in the server.
158+
When the new workload is added to this namespace or any other namespace that has the lable mentioned above, it will now automatically get registered in the server.
159159

160160
**4.1** Create a new namespace.
161161

162162
```shellsession
163163
kubectl create namespace <insert-namespace-name-here>
164164
```
165165

166-
**4.2** Add a label to it, same as that you have used for clusterSPIFFEID.
166+
**4.2** Add a lable to it, using the same one that you have used for the clusterSPIFFEID.
167167

168168
```shellsession
169169
kubectl label namespaces <namespace_name> spiffe.io/spire-managed-identity=true
@@ -175,9 +175,9 @@ kubectl label namespaces <namespace_name> spiffe.io/spire-managed-identity=true
175175
kubectl label namespace <namespace_name> istio-injection=enabled --overwrite
176176
```
177177

178-
After all edits to your namespace, the namespace would look similar as shown below.
178+
After all edits to your namespace, the namespace should look similar as shown below.
179179

180-
**Note:** You can edit further if you want using following command, but take care that your resulting yaml is not invalid. You can validate your yaml using any online validator available.
180+
**Note:** If you want to, you can edit further using the following command. But take care that your resulting yaml is not invalid. You can validate your yaml using any online validator available.
181181

182182
```shellsession
183183
kubectl edit ns <namespace_name>
@@ -207,7 +207,7 @@ status:
207207
208208
**4.4** Create and apply a ClusterSPIFFEID CRD with namespace selector.
209209
210-
Copy the clusterSPIFFEID from **[this link](https://raw.githubusercontent.com/cxteamtrials/caas-trials-content/main/services/spire/clusterspiffeid-example.yaml)** and just change the selector to **namespace selector** and make sure that the correct match label is there like shown below.
210+
Copy the clusterSPIFFEID from **[this link](https://raw.githubusercontent.com/cxteamtrials/caas-trials-content/main/services/spire/clusterspiffeid-example.yaml)** and just change the selector to **namespace selector**. Make sure that the correct match label is there like shown below.
211211
212212
```yaml
213213
apiVersion: spire.spiffe.io/v1alpha1
@@ -227,20 +227,20 @@ After editing your clusterSPIFFEID, apply it using kubectl.
227227
kubectl apply -f <your_clusterSPIFFEID_name>
228228
```
229229

230-
**4.5** After successfully creating namespace and applying CRD, deploy your application in the namespace you created. But before you deploy your application, the workloads will need the SPIFFE CSI Driver volume to access the SPIRE Agent socket. To accomplish this, we can leverage the SPIRE pod annotation template:
230+
**4.5** After successfully creating namespace and applying CRD, deploy your application in the namespace you created. But before you deploy your application, the workloads will need to have the SPIFFE CSI Driver volume be able to access the SPIRE Agent socket. To accomplish this, we can leverage the SPIRE pod annotation template:
231231

232232
```yaml
233233
annotations:
234234
inject.istio.io/templates: "sidecar,spire"
235235
```
236236
237-
You can patch it to workload or just add this to your deployment manifest at **{spec:{template:{metadata:{ annotation:}}}}** as shown below.
237+
You can patch it to the workload or just add this to your deployment manifest at **{spec:{template:{metadata:{ annotation:}}}}** as shown below.
238238
239239
![](/img/sidecar-patch.png)
240240
241241
You can get the sample bookinfo application manifest from **[this link](https://raw.githubusercontent.com/cxteamtrials/caas-trials-content/main/services/istio/release-1.16/samples/bookinfo/bookinfo.yaml)**.
242242
243-
**Note:** This manifest is annotation free, so you need to add annotation to its deployments by following above shown steps.
243+
**Note:** This manifest is annotation free, so you need to add annotation to its deployments by following the steps shown above.
244244
245245
After editing the manifest, apply it in a newly created namespace.
246246
@@ -289,7 +289,7 @@ replicaset.apps/reviews-v2-6b7c798cc8 1 1 1 37d
289289
replicaset.apps/reviews-v3-695c7f59db 1 1 1 37d
290290
```
291291

292-
Once everything is up, all workloads would get registered under SPIRE server.
292+
Once everything is up, all workloads would get registered under the SPIRE server.
293293

294294
**4.6** You can verify the registration of workloads using the following command:
295295

0 commit comments

Comments
 (0)