Configuration > NGINX Headers
For a variety of reasons you may want to configure nginx to set certain headers when using SevOne Data Insight. This can also be used to nullify large headers.
- Create kubeobjects Directory
- Create custom-headers.yaml
- Update Ingress Configuration
- Update Ansible Inventory
- Apply your Changes
- Force NGINX Config Reload
Create kubeobjects Directory
-
Create kubeobjects directory.
$ mkdir /opt/SevOne/kubeobjects
Create custom-headers.yaml
-
Determine the headers you want to change and create a file, custom-headers.yaml file.
Create /opt/SevOne/chartconfs/di_custom.yaml file
$ touch /opt/SevOne/kubeobjects/custom-headers.yaml
-
Add the following contents with your custom headers set under the data section.
Create /opt/SevOne/kubeobjects/custom-headers.yaml file
apiVersion: v1 kind: ConfigMap metadata: name: custom-headers namespace: default data: X-Different-Name: "true" X-Request-Start: t=${msec} X-Using-Nginx-Controller: "true"
Update Ingress Configuration
-
Using a text editor of your choice, edit /opt/SevOne/chartconfs/ingress_custom.yaml file to set environment variable controller and then, save it.
If /opt/SevOne/chartconfs/ingress_custom.yaml file does not exist, please create it.$ touch /opt/SevOne/chartconfs/ingress_custom.yaml`
controller: config: proxy-set-headers: "default/custom-headers"
Update Ansible Inventory
-
Using a text editor of your choice, edit /etc/ansible/group_vars/all/custom-headers.yaml file to set environment variable kube_object_ingress and then, save it.
If /etc/ansible/group_vars/all/custom-headers.yaml file does not exist, please create it.$ touch /etc/ansible/group_vars/all/custom-headers.yaml`
kube_object_ingress: enabled: true files: - /opt/SevOne/kubeobjects/custom-headers.yaml
Apply your Changes
$ sevone-cli cluster up
Force NGINX Config Reload
When checking the nginx config, you may find that the custom headers configmap and the configuration differ. This typically happens based on which files are loaded when bringing up SevOne Data Insight.
-
To force the nginx config to reload, change the ingress controller config map.
$ kubectl edit cm ingress-ingress-nginx-controller
This will open the NGINX config file in text editor, vi. Find the data section and change variable keep-alive-requests.
data: keep-alive-requests: "10001"
-
To save and exit the file, enter :wq!
-
Kubernetes will automatically regenerate NGINX's config.