Skip to content

Commit 2771a03

Browse files
authored
k8s: start using grpc health check for cartservice (GoogleCloudPlatform#63)
1 parent 848d4bb commit 2771a03

File tree

10 files changed

+9
-2701
lines changed

10 files changed

+9
-2701
lines changed

kubernetes-manifests/cartservice.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ spec:
4545
readinessProbe:
4646
initialDelaySeconds: 15
4747
exec:
48-
command: ["/cartservice_probe"]
48+
command: ["/bin/grpc_health_probe", "-addr=:7070"]
4949
livenessProbe:
5050
initialDelaySeconds: 15
5151
periodSeconds: 10
5252
exec:
53-
command: ["/cartservice_probe"]
53+
command: ["/bin/grpc_health_probe", "-addr=:7070"]
5454
---
5555
apiVersion: v1
5656
kind: Service

kubernetes-manifests/frontend.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
livenessProbe:
3939
initialDelaySeconds: 10
4040
httpGet:
41-
path: "/"
41+
path: "/_healthz"
4242
port: 8080
4343
httpHeaders:
4444
- name: "Cookie"

src/cartservice/Dockerfile

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
FROM golang:1.10 as probe
2-
RUN wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
3-
chmod +x /go/bin/dep
4-
ENV PROJECT github.com/GoogleCloudPlatform/microservices-demo/src/cartservice/probe
5-
WORKDIR /go/src/$PROJECT
6-
COPY probe/Gopkg.* ./
7-
RUN dep ensure --vendor-only -v
8-
COPY ./probe ./
9-
RUN go build -o /cartservice_probe .
10-
111
FROM microsoft/dotnet:2.1-sdk-alpine as builder
122
WORKDIR /app
133
COPY . .
@@ -17,8 +7,11 @@ RUN dotnet restore && \
177

188
# cartservice
199
FROM alpine:3.8
20-
# Add the probe
21-
COPY --from=probe /cartservice_probe /cartservice_probe
10+
11+
RUN GRPC_HEALTH_PROBE_VERSION=v0.1.0-alpha.1 && \
12+
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
13+
chmod +x /bin/grpc_health_probe
14+
2215
# Dependencies for runtime
2316
# busybox-extras => telnet
2417
RUN apk add --no-cache \
@@ -32,4 +25,4 @@ RUN apk add --no-cache \
3225
icu
3326
WORKDIR /app
3427
COPY --from=builder /cartservice .
35-
ENTRYPOINT ["./cartservice", "start"]
28+
ENTRYPOINT ["./cartservice", "start"]

src/cartservice/probe/.dockerignore

-1
This file was deleted.

src/cartservice/probe/Gopkg.lock

-101
This file was deleted.

src/cartservice/probe/Gopkg.toml

-42
This file was deleted.

src/cartservice/probe/README.md

-4
This file was deleted.

src/cartservice/probe/genproto.sh

-22
This file was deleted.

0 commit comments

Comments
 (0)