You are viewing documentation for Anthos Service Mesh 1.8. View the latest documentation or select another available version:

Deploying Services

Deploying Services to clusters with Anthos Service Mesh is almost the same as deploying Services to clusters without Anthos 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, Anthos 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 Anthos 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 Anthos Service Mesh, be sure to inject sidecar proxies.

What's next