gzip in gke with nginx-ingress

1/22/2019

I'm trying to configure gzip to work in a python application that runs on a kubernetes with nginx-ingress in GKE. But I discovered that it is no use to enable gzip in the ingress-controller config-map because I need to enable compression on the backend as I understand it.

How can I enable compression on the backend of my python application to run gzip on nginx controller?

My main problem is that searching here in stackoverflow I know I need to put the compression in the backend, just do not know how to do this.

-- Jonatas Oliveira
google-cloud-platform
google-kubernetes-engine
gzip
kubernetes

1 Answer

1/23/2019

This makes this as a nginx conversation. There are a lot of docs available which guides on hows and whats with nginx compression. Essentially, you have to add a bunch of gzip related settings and options in your nginx configuration file.

The tread shared above is a good starter and shows exactly what needs to be on the nginx conf. Please note that, as a good practice, do not compress any/all inbound packets as this essentially adds more compute burden on the CPU. The nginx conf has one option to only compress packets which exceed certain size.

-- Raunak Jhawar
Source: StackOverflow