Search code examples
kubernetesgoogle-kubernetes-enginekubernetes-ingress

Delete Service when GKE Ingress is stilling linking


I have a GKE ingress and 3 backend services linking to it. Then I found I couldn't delete any service because of the linking I suppose. Is it possible to temporarily disable the ingress? Because sometime during the deployment, I have to remove the service and then install the service again.


Solution

    • As per this official doc, to disable the GKE ingress, you can modify the ingress resource and set the enabled field to false. This can be done using the kubectl command-line tool command : kubectl edit ingress <ingress-name> or by modifying the YAML configuration file for the ingress resource.

    The following BackendConfig manifest disables the nginx ingress :

    apiVersion: cloud.google.com/v1
    kind: BackendConfig
    metadata:
      name: my-backendconfig
    spec:
      ingress:
        enabled: false
      securityPolicy:
        name: " "
    
    • As per this Blog by Shahalamol, A boolean value can be set to enable or disable the service which helps in disabling the ingress. You can follow the example given in this blog .
    ingress:
    default_backend: false