Pub/Sub deployment with credentials

Kubernetes deployment for the Pub/Sub sample app, with GOOGLE_APPLICATION_CREDENTIALS added as an environment variable.

Code sample

YAML

  apiVersion 
 : 
  
 apps/v1 
 kind 
 : 
  
 Deployment 
 metadata 
 : 
  
 name 
 : 
  
 pubsub 
 spec 
 : 
  
 selector 
 : 
  
 matchLabels 
 : 
  
 app 
 : 
  
 pubsub 
  
 template 
 : 
  
 metadata 
 : 
  
 labels 
 : 
  
 app 
 : 
  
 pubsub 
  
 spec 
 : 
  
 volumes 
 : 
  
 - 
  
 name 
 : 
  
 google-cloud-key 
  
 secret 
 : 
  
 secretName 
 : 
  
 pubsub-key 
  
 containers 
 : 
  
 - 
  
 name 
 : 
  
 subscriber 
  
 image 
 : 
  
 us-docker.pkg.dev/google-samples/containers/gke/pubsub-sample:v2 
  
 volumeMounts 
 : 
  
 - 
  
 name 
 : 
  
 google-cloud-key 
  
 mountPath 
 : 
  
 /var/secrets/google 
  
 env 
 : 
  
 - 
  
 name 
 : 
  
 GOOGLE_APPLICATION_CREDENTIALS 
  
 value 
 : 
  
 /var/secrets/google/key.json 
 

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .

Design a Mobile Site
View Site in Mobile | Classic
Share by: