Skip to content

Commit

Permalink
add health check
Browse files Browse the repository at this point in the history
  • Loading branch information
mikutas committed Dec 4, 2024
1 parent 886143d commit 871faf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 4 additions & 6 deletions helm/greeter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,11 @@ resources: {}

# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
livenessProbe:
httpGet:
path: /
port: http
grpc:
port: 50051
readinessProbe:
httpGet:
path: /
port: http
grpc:
port: 50051

#This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
autoscaling:
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (

"google.golang.org/grpc"
pb "google.golang.org/grpc/examples/helloworld/helloworld"
"google.golang.org/grpc/health"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"
)

Expand All @@ -51,6 +53,8 @@ func main() {
log.Fatalf("failed to listen: %v", err)
}
s := grpc.NewServer()
hc := health.NewServer()
healthgrpc.RegisterHealthServer(s, hc)
pb.RegisterGreeterServer(s, &server{})
reflection.Register(s)
if err := s.Serve(lis); err != nil {
Expand Down

0 comments on commit 871faf6

Please sign in to comment.