# Customize Kubenretes Ingress

## Customizing Ingress rules for exchanges on Kubernetes

Once you run HollaEx CLI commands with `--kube` flag, HollaEx CLI will automatically generate Ingress rules for Kubernetes with a default form. You can check these generated templates under `templates/kubernetes/<EXCHANGE_NAME>-ingress.yaml>` .

Default Ingress should be similar to the examples down below.

{% hint style="info" %}
The HollaEx CLI generates Ingress rules which compatible with [`kubernetes/nginx-ingress`](https://github.com/kubernetes/ingress-nginx)`.`If you are planning to use a different Ingress controller, please customize annotations and detailed values based on your own ones.
{% endhint %}

{% hint style="warning" %}
Nginx rate limit setups on `nginx.ingress.kubernetes.io/configuration-snippet` are following pre-defined rate limit zone setups on HollaEx's own Ingress controller.&#x20;

* api : 4r/s
  {% endhint %}

{% hint style="warning" %}
Please reference these values and add them to your own Ingress controller. For example, `kubernetes/nginx-ingress` support annotation called `http-snippet` to let users inject code snippets on Nginx.conf.
{% endhint %}

```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo-hollaex-ingress-api
  namespace: demo-hollaex
  annotations:
    kubernetes.io/ingress.class: "nginx"
    kubernetes.io/tls-acme: "true"
    cert-manager.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/proxy-body-size: "6m"
    nginx.ingress.kubernetes.io/server-snippet: |
        location @maintenance_503 {
          internal;
          return 503;
        }
    nginx.ingress.kubernetes.io/configuration-snippet: |
      limit_req zone=api burst=10 nodelay;
      limit_req_log_level notice;
      limit_req_status 429;

      #error_page 403 @maintenance_503;

spec:
  rules:
  - host: api.testnet.demo-hollaex.io
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: demo-hollaex-server-api
            port:
              number: 10010
  
  tls:
  - secretName: demo-hollaex-tls-cert
    hosts:
    - api.testnet.demo-hollaex.io
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo-hollaex-ingress-plugins
  namespace: demo-hollaex
  annotations:
    kubernetes.io/ingress.class: "nginx"
    kubernetes.io/tls-acme: "true"
    cert-manager.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/server-snippet: |
        location @maintenance_503 {
          internal;
          return 503;
        }
    nginx.ingress.kubernetes.io/proxy-body-size: "6m"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      #error_page 403 @maintenance_503;

spec:
  rules:
  - host: api.testnet.demo-hollaex.io
    http:
      paths:
      - pathType: Prefix
        path: /plugins
        backend:
          service:
            name: demo-hollaex-server-plugins
            port:
              number: 10011
    
  
  tls:
  - secretName: demo-hollaex-tls-cert
    hosts:
    - api.testnet.demo-hollaex.io

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo-hollaex-ingress-stream
  namespace: demo-hollaex
  annotations:
    kubernetes.io/ingress.class: "nginx"
    kubernetes.io/tls-acme: "true"
    cert-manager.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/server-snippet: |
        location @maintenance_503 {
          internal;
          return 503;
        }
    nginx.ingress.kubernetes.io/proxy-body-size: "6m"
    nginx.org/websocket-services: "demo-hollaex-server-stream"
    nginx.ingress.kubernetes.io/upstream-hash-by: "$binary_remote_addr"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      #error_page 403 @maintenance_503;
spec:
  rules:
  - host: api.testnet.demo-hollaex.io
    http:
      paths:
      - pathType: Prefix
        path: /stream
        backend:
          service:
            name: demo-hollaex-server-stream
            port:
              number: 10080
  
  
  tls:
  - secretName: demo-hollaex-tls-cert
    hosts:
    - api.testnet.demo-hollaex.io

```

#### Guide for the `nginxinc/kubernetes-ingress` users.

If you are planning to use `nginxinc/kubernetes-ingress`, certain annotations should be modified as shown below.

{% hint style="info" %}
If you are planning to use split Ingress rules like the example above, Consider using `nginx.org/mergeable-ingress-type.`
{% endhint %}

* `nginx.ingress.kubernetes.io/proxy-body-size`-> `nginx.org/client-max-body-size`
* `nginx.ingress.kubernetes.io/configuration-snippet` -> `nginx.org/location-snippets`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hollaex.com/advanced/customize-kubenretes-ingress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
