northwesternmutual / kanali

A Kubernetes Native API Management Solution
Apache License 2.0
186 stars 21 forks source link

Health Check #79

Closed brtnshrdr closed 7 years ago

brtnshrdr commented 7 years ago

It would be nice if Kanali had a default health check available (and configured in the kube service files). When trying to create an Ingress with Google Container Engine, the ingress-gce process sets up an automatic health check that says a healthy pod is based on either the liveness probe or a request to the service with a path of/ must return a 200. If we setup Kanali on a new cluster, then create the LoadBalancer, the health check fails unless we were to deploy an ApiProxy at the / path.

frankgreco commented 7 years ago

@brtnshrdr

This can accomplish this in two ways:

option 1 - use a tcp socket

livenessProbe:
  tcpSocket:
    port: <kanali port>
  initialDelaySeconds: 180
readinessProbe:
  tcpSocket:
    port: <kanali port>
  initialDelaySeconds: 10

option 2: use a mock response

kind: ConfigMap
apiVersion: v1
metadata:
  name: kanali-alive
  namespace: default
data:
  response: |-
    [{
        "route": "/alive",
        "code": 200,
        "method": "GET",
        "body": {}
    }]

Make sure mock responses are enabled

[proxy]
enable_mock_responses = true
brtnshrdr commented 7 years ago

The tcp socket method should work great. Thanks!