/k8s-nodejs-app

Primary LanguageJavaScriptMIT LicenseMIT

k8s-nodejs-app

This project is created during the Kubernetes learning time.

Build image

$ docker build --no-cache . -t logansua/k8s-test-app

Note: Image name logansua/k8s-test-app is used in ./kustomization/server.yaml as container image.

Apply K8s configuration

$ kubectl apply -k kustomization

Usage

Liveness

Used by K8s for livenessProbe configration

$ curl http://localhost/liveness

Readiness

Used by K8s for startupProbe and readinessProbe configration

$ curl http://localhost/health

Any other path is used for main action

$ curl http://localhost/test/path/12321 -H 'foo-header:bar-value' -H 'redis-key:foo-header'

Output

{
  "path": "/test/path/1?redis-key=accept-encoding",
  "headers": {
    "redis-key": "accept-encoding",
    ...
    "accept-encoding": "gzip, deflate, br"
  },
  "env": {
    "TEST_ENV_VARIABLE": "foo",
    "SECRET_USERNAME": "bar",
    "SECRET_PASSWORD": "baz"
  },
  "redis": {
    "accept-encoding": "gzip, deflate, br"
  }
}