Skip to content

Commit 58e9e1c

Browse files
committed
Deploy the delve container in our cluster
1 parent d4894d8 commit 58e9e1c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,22 @@ A message appears indicating that the docker image did not exist before:
167167
Image: "setlog/debug-k8s:latest" with ID "sha256:944baa03d49698b9ca1f22e1ce87b801a20ce5aa52ccfc648a6c82cf8708a783" not present on node "local-debug-k8s-worker"
168168
```
169169

170-
### Starting the delve server in the cluster
170+
### Deploy the delve container in our cluster
171171

172-
Now we want to create a persistent volume and its claim in order to mount the project path into the worker node:
172+
First of all we need a persistent volume and its claim in order to mount the project path into the node:
173173

174174
```sh
175175
kubectl create -f cluster/persistent-volume.yaml
176176
```
177177

178178
The interesting part here is:
179179

180-
```
180+
```yaml
181181
hostPath:
182182
path: /go/src
183183
```
184184
185-
Let's take a look at the full chain of mounting the local project path into the pod, since you want probably to adjust them to your environment:
185+
Below is an image that shows the configurations through which our local path is mounted. In your environment it could be another path:
186186
187187
![Mounting](images/mounting.png "How to mount the project folder")
188188
@@ -195,22 +195,23 @@ kubectl get pvc
195195
go-pvc Bound go-pv 256Mi RWO hostpath 51s
196196
```
197197

198-
You are ready to start the service in debug mode:
198+
Now we are ready to deploy all our services in debug mode:
199199

200200
```sh
201201
kubectl create -f cluster/deploy-service.yaml
202202
```
203203

204-
Let's go through the deployment.
204+
Let's go through the pod manifest:
205205

206-
* Image name is what we loaded into the kind cluster with the command `kind load image...`. _imagePullPolicy_ must be set to _IfNotPresent_, because it is already loaded, we don't want Kubernetes to try loading it again.
206+
* _image_ is the previously built and loaded image into the kind cluster with `kind load image...`
207+
* _imagePullPolicy_ must be set to _IfNotPresent_ because it's already loaded and we don't want Kubernetes to try it again
207208

208209
```yaml
209210
image: setlog/debug-k8s:latest
210211
imagePullPolicy: IfNotPresent
211212
```
212213
213-
* We use the persistent volume claim to mount the project path into the pod and make `/go/src` to be linked with `${GOPATH}/src` on your computer:
214+
* We use the persistent volume claim to mount the project path into the pod, so that `/go/src` will be linked to `${GOPATH}/src` on your local system
214215

215216
```yaml
216217
containers:
@@ -223,16 +224,16 @@ Let's go through the deployment.
223224
- name: go-volume
224225
persistentVolumeClaim:
225226
claimName: go-pvc
226-
````
227+
```
227228

228-
* As there might be several workers in your cluster, we deploy the pod on the one, that is labelled with _debug=true_. The docker image _setlog/debug-k8s_ has been loaded earlier in it already.
229+
* As there might be several nodes in your kubernetes cluster, we deploy the pod on the node, that is labelled with _debug=true_. The docker image _setlog/debug-k8s_ was already loaded on this node.
229230

230231
```yaml
231232
nodeSelector:
232233
debug: "true"
233234
```
234235

235-
* Service _service-debug_ has the type _NodePort_ and is mounted into the worker node. This port 30123 is equal to the parameter _--listen=:30123_ in the Dockerfile, which makes it possible to send debug commands to the delve server.
236+
* Service _service-debug_ has the type _NodePort_ and is mounted to the node. This port 30123 is equal to the parameter _--listen=:30123_ in the Dockerfile, which makes it possible to send debug commands to the delve server.
236237

237238
* Service _debug-k8s_ will be connected to the ingress server in the final step. It serves for exposing the API endpoints we are going to debug.
238239

@@ -255,7 +256,8 @@ Usually it takes a couple of seconds to start the debugging process with delve.
255256
Also, you can output logs of the pod by performing `kubectl logs $PODNAME` in order to make sure the delve API server is listening at 30123.
256257

257258
Output:
258-
```
259+
260+
```sh
259261
API server listening at: [::]:30123
260262
```
261263

0 commit comments

Comments
 (0)