Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Deploying Google Run Service resets ingress

I'm deploying a few services from a yaml files on Google Run using the syntax:

 

 

 

gcloud run services replace service.yaml

 

 

 

The yaml starts as follows (was generated from the output of 'gcloud run services describe <SERVICE_NAME>'):

 

 

 

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: <SERVICE_NAME>
  labels:
    cloud.googleapis.com/location: <REGION>
spec:
  template:
    metadata:
      labels:
        run.googleapis.com/startupProbeType: Default
      annotations:
        autoscaling.knative.dev/maxScale: '100'
        run.googleapis.com/client-name: cloud-console
        run.googleapis.com/startup-cpu-boost: 'true'
        run.googleapis.com/ingress: internal
        run.googleapis.com/ingress-status: internal

 

 

 

Deployment is successful, but ingress value is not preserved (or switched to internal if I set it as 'internal' from the UI).

If I execute:

 

 

 

 gcloud run services update --region <REGION> <SERVICE_NAME> --ingress=internal

 

 

 

it does switch it.

*Is it possible to state in the YAML the ingress option?

 

 

Solved Solved
0 4 220
1 ACCEPTED SOLUTION

Hi @Oz3434,

As per the documentation on "Set ingress", the run.googleapis.com/ingress: field isn't set under the spec. Could you try using this code instead?

 

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: <SERVICE_NAME>
  labels:
    cloud.googleapis.com/location: <REGION>
  annotations:
    run.googleapis.com/ingress: internal
spec:
  template:
    metadata:
      labels:
        run.googleapis.com/startupProbeType: Default
      annotations:
        autoscaling.knative.dev/maxScale: '100'
        run.googleapis.com/client-name: cloud-console
        run.googleapis.com/startup-cpu-boost: 'true'
        run.googleapis.com/ingress-status: internal

 

 Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

View solution in original post

4 REPLIES 4

Yes, you can (see doc)

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  annotations:
    run.googleapis.com/ingress: "internal"
 
name: SERVICE
spec:
  template:
    metadata:
      name: REVISION

 

 

     ......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator

I verified that is still does not work with double quotation marks as well (although the simulator in the doc generates without).
@NoCommandLine , are you able to make it work in your setup?

Hi @Oz3434,

As per the documentation on "Set ingress", the run.googleapis.com/ingress: field isn't set under the spec. Could you try using this code instead?

 

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: <SERVICE_NAME>
  labels:
    cloud.googleapis.com/location: <REGION>
  annotations:
    run.googleapis.com/ingress: internal
spec:
  template:
    metadata:
      labels:
        run.googleapis.com/startupProbeType: Default
      annotations:
        autoscaling.knative.dev/maxScale: '100'
        run.googleapis.com/client-name: cloud-console
        run.googleapis.com/startup-cpu-boost: 'true'
        run.googleapis.com/ingress-status: internal

 

 Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

I see. spec -> template -> metadata ->annotations ->  run.googleapis.com/ingress is not the correct location.

Thanks