@@ -122,47 +122,48 @@ kubectl label nodes local-debug-k8s-worker debug=true
122
122
123
123
### Creating a docker image
124
124
125
- Our service has only one ` /hello ` endpoint and writes just a few logs. The interesting part is in the Dockerfile:
125
+ Our service has only one endpoint ` /hello ` and writes just a few logs. Let's checkout the Dockerfile for delve :
126
126
127
127
``` Dockerfile
128
128
FROM golang:1.13-alpine
129
129
130
130
# compile gcc statically
131
131
ENV CGO_ENABLED=0
132
132
ENV GOROOT=/usr/local/go
133
- # this path will be mounted in deploy-service.yaml later
133
+ # this path will be mounted in deploy-service.yaml
134
134
ENV GOPATH=${HOME}/go
135
135
ENV PATH=$PATH:${GOROOT}/bin
136
136
137
- EXPOSE 30123 # for delve
138
- EXPOSE 8090 # for API calls
137
+ # Install git and get the latest version of delve via go
138
+ RUN apk update && apk add --no-cache \
139
+ git && \
140
+ go get github.com/go-delve/delve/cmd/dlv
139
141
140
142
# ATTENTION: you want to check, if the path to the project folder is the right one here
141
143
WORKDIR /go/src/github.com/setlog/debug-k8s
142
144
143
- # Install delve, our version is 1.4.1
144
- RUN apk update && apk add git && \
145
- go get github.com/go-delve/delve/cmd/dlv
145
+ # 30123 for delve and 8090 for API calls
146
+ EXPOSE 30123 8090
146
147
147
- # let start delve at the entrypoint
148
+ # let's start delve as the entrypoint
148
149
ENTRYPOINT ["/go/bin/dlv" , "debug" , "." , "--listen=:30123" , "--accept-multiclient" , "--headless=true" , "--api-version=2" ]
149
150
```
150
151
151
- First, build the docker image locally :
152
+ So, let's build build our docker image from our [ Dockerfile ] ( Dockerfile ) :
152
153
153
154
``` sh
154
- docker build -t setlog/debug-k8s .
155
+ docker build -t setlog/debug-k8s ./Dockerfile
155
156
```
156
157
157
- Load the docker image into the node _ local-debug-k8s-worker_ :
158
+ After the build is done, we load the image ` setlog/debug-k8s:latest ` on the node _ local-debug-k8s-worker_ :
158
159
159
160
``` sh
160
161
kind load docker-image setlog/debug-k8s:latest --name=local-debug-k8s --nodes=local-debug-k8s-worker
161
162
```
162
163
163
- This message will be shown, and it is just saying that the image was not there :
164
+ A message appears indicating that the docker image did not exist before :
164
165
165
- ```
166
+ ``` sh
166
167
Image: " setlog/debug-k8s:latest" with ID " sha256:944baa03d49698b9ca1f22e1ce87b801a20ce5aa52ccfc648a6c82cf8708a783" not present on node " local-debug-k8s-worker"
167
168
```
168
169
0 commit comments