http-check

command
v2.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

README

HTTP Get Request Check

The HTTP check can be configured to send a GET / POST / PUT / DELETE / PATCH request to a specified URL, looking for a certain specific status code's response. This check reports a success upon receiving a response with the status code matching with the expected status code (like 200 or 204, etc.) and a failure on any other status code.

You can specify the URL to check with the CHECK_URL environment variable in the .yaml file.

The check will exit without sending a request if the specified URL is not prefixed with an HTTP or HTTPS protocol.

Example HTTP Check Specs

GET check

---
apiVersion: comcast.github.io/v1
kind: KuberhealthyCheck
metadata:
  name: http
  namespace: kuberhealthy
spec:
  runInterval: 5m
  timeout: 10m
  podSpec:
    containers:
      - name: https
        image: kuberhealthy/http-check:v1.4.3
        imagePullPolicy: IfNotPresent
        env:
          - name: CHECK_URL
            value: "https://reqres.in/api/users"
          - name: COUNT #### default: "0"
            value: "5"
          - name: SECONDS #### default: "0"
            value: "1"
          - name: PASSING_PERCENT #### default: "100"
            value: "80"
        resources:
          requests:
            cpu: 15m
            memory: 15Mi
          limits:
            cpu: 25m
        restartPolicy: Always
    terminationGracePeriodSeconds: 5

POST check

apiVersion: comcast.github.io/v1
kind: KuberhealthyCheck
metadata:
  name: http
  namespace: kuberhealthy
spec:
  runInterval: 5m
  timeout: 10m
  podSpec:
    containers:
      - name: https
        image: kuberhealthy/http-check:v1.4.3
        imagePullPolicy: IfNotPresent
        env:
          - name: CHECK_URL
            value: "https://reqres.in/api/users"
          - name: COUNT #### default: "0"
            value: "1"
          - name: SECONDS #### default: "0"
            value: "1"
          - name: PASSING_PERCENT #### default: "100"
            value: "100"
          - name: REQUEST_TYPE #### default: "GET"
            value: "POST"
          - name: REQUEST_BODY #### default: "{}"
            value: '{"name": "morpheus", "job": "leader"}'
          - name: EXPECTED_STATUS_CODE #### default: "200"
            value: "201"
        resources:
          requests:
            cpu: 15m
            memory: 15Mi
          limits:
            cpu: 25m
        restartPolicy: Always
    terminationGracePeriodSeconds: 5
How-to

Make sure you are using the latest release of Kuberhealthy 2.0.0.

Apply a .yaml file similar to the one shown above with kubectl apply -f

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL