First of all, I am using an Nginx ingress controller with the helm for the gke and I am using ModSecurity as a waf. Nevertheless, I was researching for a new kind of waf to display the results of prevention, and cloud armor looks like what I am looking for. Unfortunately, it works only with HTTP/HTTPS Load Balancers but my Nginx ingress external load balancer is a TCP load balancer. As far as I research, I can't convert this load balancer's protocol TCP to HTTP/HTTPS.
- First Question, Is this conversation possible and if it is possible, Can I use cloud armor on it.
Secondly, I tried to create a new cloud load balancer to route traffic through it. Unhappily, Even I can active cloud armor on it, Routing is not working as I expected because it returned me 502 anyway even if it health checks look okay.
Finally, i tried to use BackendConfig with yaml :
apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
name: armor-backendconfig
spec:
securityPolicy:
name: "bla-armor"
apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/backend-config: '{"ports": {"443":"bla-backendconfig"}}'
spec:
clusterIP: xx.xx.xx.xx
externalTrafficPolicy: Local
healthCheckNodePort: xxxxxxx
loadBalancerIP: xx.xx.xxxx.xx
ports:
- name: http
nodePort: 31000
port: 80
protocol: TCP
targetPort: http
And it doesn't work again. That was my last hope. Is there any advice for here?
Directly integrating Cloud Armor with the NGINX ingress controller isn't feasible. The alternative approach involves leveraging Google Cloud HTTP Load Balancer (GLB) and employing Network Endpoint Groups (NEGs) as the backend for the load balancer instead.
To create the NEGs, an annotation in the Kubernetes service was essential, such as:
Additionally, for HTTPS backends, ensure to include the SSL certificate and specify the HTTPS backend in the GLB and also port 443 in the annotation.
Please take note: The NEG backends will initially appear in an unknown state, and the GLB backends will show as 0 until you designate them as the backend for the GLB. Once the GLB health checks pass, the NEG Backends will become healthy, and the GLB backends will reflect the number of NGINX ingress instances marked as healthy.