New to Voyager? Please start here.

Agent Check

haproxy-agent-check can be enabled for a specific backend server by assigning the agent server port in ingress.appscode.com/agent-port annotations to the corresponding service. You can also add agent-inter in ingress.appscode.com/agent-interval annotations to the same service, which defaults to 2000ms if not mentioned.

Example

First deploy and expose a test server:

$ kubectl apply -f test-server.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: test-server
  name: test-server
  namespace: default
spec:
  selector:
    matchLabels:
      run: test-server
  template:
    metadata:
      labels:
        run: test-server
    spec:
      containers:
      - image: appscode/test-server:2.4
        name: test-server
---
apiVersion: v1
kind: Service
metadata:
  labels:
    run: test-server
  name: test-server
  namespace: default
spec:
  ports:
  - port: 8080
    targetPort: 8080
    name: web
  - port: 5555
    targetPort: 5555
    name: agent
  selector:
    run: test-server

Here, port 8080 will serve client’s request and port 5555 will be used for agent-check.

Then deploy the ingress:

$ kubectl apply test-ingress.yaml

apiVersion: voyager.appscode.com/v1
kind: Ingress
metadata:
  name: test-ingress
  namespace: default
spec:
  rules:
  - http:
      paths:
      - path: /app
        backend:
          service:
            name: test-server
            port:
              number: 8080

Now we need to annotate the backend service to enable agent-check for that backend.

$ kubectl annotate svc test-server ingress.appscode.com/agent-port="5555"

To change the default agent-interval value, annotate the same service with:

$ kubectl annotate svc test-server ingress.appscode.com/agent-interval="3s"

Time Format

These timeout values are generally expressed in milliseconds (unless explicitly stated otherwise) but may be expressed in any other unit by suffixing the unit to the numeric value. Supported units are :

  • us : microseconds. 1 microsecond = 1/1000000 second
  • ms : milliseconds. 1 millisecond = 1/1000 second. This is the default.
  • s : seconds. 1s = 1000ms
  • m : minutes. 1m = 60s = 60000ms
  • h : hours. 1h = 60m = 3600s = 3600000ms
  • d : days. 1d = 24h = 1440m = 86400s = 86400000ms