Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Men-deploy Layanan
Men-deploy Layanan ke cluster dengan Cloud Service Mesh hampir sama dengan men-deploy Layanan ke cluster tanpa Cloud Service Mesh. Anda perlu membuat beberapa perubahan pada manifes Kubernetes:
Buat
Layanan Kubernetes
untuk semua container. Semua
Deployment
harus memiliki
Layanan Kubernetes yang terlampir.
Beri nama port Layanan Anda. Meskipun GKE memungkinkan Anda
menentukan port Service yang tidak bernama, Cloud Service Mesh mengharuskan Anda memberikan
nama untuk port yang cocok dengan
protokol port.
Beri label pada Deployment Anda. Hal ini memungkinkan Anda menggunakan fitur pengelolaan traffic Cloud Service Mesh seperti memisahkan traffic antar-versi layanan yang sama.
Contoh Deployment dan Layanan berikut mengilustrasikan persyaratan ini:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[],[],null,["# Deploying Services\n==================\n\nDeploying Services to clusters with Cloud Service Mesh is almost the\nsame as deploying Services to clusters without Cloud Service Mesh. You do need to\nmake some changes to your Kubernetes manifests:\n\n- Create\n [Kubernetes Services](/kubernetes-engine/docs/concepts/network-overview#services)\n for all containers. All\n [Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)\n should have a\n Kubernetes Service attached.\n\n- Name your Service ports. Although GKE allows you to\n define unnamed Service ports, Cloud Service Mesh requires that you provide a\n [name for a port](/service-mesh/v1.19/docs/naming-service-ports) that matches the port's\n protocol.\n\n- Label your Deployments. This allows you to use Cloud Service Mesh traffic\n management features such as splitting traffic between versions of the same\n service.\n\nThe following example Deployment and Service illustrate these requirements: \n\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: helloserver\n spec:\n replicas: 1\n selector:\n matchLabels:\n app: helloserver\n template:\n metadata:\n labels:\n app: helloserver\n spec:\n containers:\n - image: gcr.io/google-samples/istio/helloserver:v0.0.1\n imagePullPolicy: Always\n name: main\n restartPolicy: Always\n terminationGracePeriodSeconds: 5\n\n apiVersion: v1\n kind: Service\n metadata:\n name: hellosvc\n spec:\n ports:\n - name: http\n port: 80\n targetPort: 8080\n selector:\n app: helloserver\n type: LoadBalancer\n\nAfter deploying your Services on a cluster with Cloud Service Mesh, be sure to\n[inject sidecar proxies](/service-mesh/v1.19/docs/anthos-service-mesh-proxy-injection).\n\nWhat's next\n-----------\n\n- [Preparing an application for Cloud Service Mesh](/service-mesh/v1.19/docs/prepare-app-for-anthos-service-mesh)\n\n- [Deploy the Online Boutique sample application](/service-mesh/v1.19/docs/onlineboutique-install-kpt)"]]