Deploying Services

Deploying Services to clusters with Cloud Service Mesh is almost the same as deploying Services to clusters without Cloud Service Mesh. You do need to make some changes to your Kubernetes manifests:

  • Create Kubernetes Services for all containers. All Deployments should have a Kubernetes Service attached.

  • Name your Service ports. Although GKE allows you to define unnamed Service ports, Cloud Service Mesh requires that you provide a name for a port that matches the port's protocol.

  • Label your Deployments. This allows you to use Cloud Service Mesh traffic management features such as splitting traffic between versions of the same service.

The following example Deployment and Service illustrate these requirements:

  apiVersion 
 : 
  
 apps/v1 
 kind 
 : 
  
 Deployment 
 metadata 
 : 
  
 name 
 : 
  
 helloserver 
 spec 
 : 
  
 replicas 
 : 
  
 1 
  
 selector 
 : 
  
 matchLabels 
 : 
  
 app 
 : 
  
 helloserver 
  
 template 
 : 
  
 metadata 
 : 
  
 labels 
 : 
  
 app 
 : 
  
 helloserver 
  
 spec 
 : 
  
 containers 
 : 
  
 - 
  
 image 
 : 
  
 gcr.io/google-samples/istio/helloserver:v0.0.1 
  
 imagePullPolicy 
 : 
  
 Always 
  
 name 
 : 
  
 main 
  
 restartPolicy 
 : 
  
 Always 
  
 terminationGracePeriodSeconds 
 : 
  
 5 
 
  apiVersion 
 : 
  
 v1 
 kind 
 : 
  
 Service 
 metadata 
 : 
  
 name 
 : 
  
 hellosvc 
 spec 
 : 
  
 ports 
 : 
  
 - 
  
 name 
 : 
  
 http 
  
 port 
 : 
  
 80 
  
 targetPort 
 : 
  
 8080 
  
 selector 
 : 
  
 app 
 : 
  
 helloserver 
  
 type 
 : 
  
 LoadBalancer 
 

After deploying your Services on a cluster with Cloud Service Mesh, be sure to inject sidecar proxies .

What's next

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