Skip to content

Latest commit

 

History

History
58 lines (53 loc) · 1.24 KB

README.md

File metadata and controls

58 lines (53 loc) · 1.24 KB

nginx-cache-ingress

Nginx with enabled local cache and custom environment variable to deploy on kubernetes cluster as part of caching system.

Instruction

docker build -t nginx-cache .
docker run -dit -e URL=URL_TO_BE_CACHED(http/s://cker.ir) -e SIZE=CACHE_SIZE(example 5g) --name=caching nginx-cache

OR

docker pull mormoroth/nginx-cache
docker run -dit -e URL=https://ha.cker.ir -e SIZE=3g --name nginx-cache mormoroth/nginx-cache:latest

HOW TO USE INSIDE Kubernetes

Change ENV values inside deployment.yaml

    spec:
      containers:
      - env:
        - name: SIZE
          value: 3g
        - name: URL
          value: https://somesite.tobe.cached

Change domain inside ingress.yaml that serves cached content from bucket or any object storage defined in deployment.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx-cache
  namespace: cker-endpoint
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: cdn.cker.ir
    http:
      paths:
      - path: /
        backend:
          serviceName: nginx-cache
          servicePort: 80
  tls:
  - hosts:
    - cdn.cker.ir
    secretName: cker-wildcard
kubectl create -f .