Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini memberikan petunjuk untuk mengonfigurasi kebijakan jaringan traffic lintas project di perangkat Google Distributed Cloud (GDC) dengan air gap.
Traffic lintas project mengacu pada komunikasi antara layanan dan workload dari namespace project yang berbeda, tetapi dalam organisasi yang sama.
Layanan dan workload dalam project diisolasi dari layanan dan workload eksternal secara default. Namun, layanan dan workload dari namespace project yang berbeda dan dalam organisasi yang sama dapat saling berkomunikasi dengan menerapkan kebijakan jaringan traffic lintas project.
Sebelum memulai
Untuk mengonfigurasi kebijakan jaringan traffic intra-project, Anda harus memiliki hal berikut:
Project yang ada. Untuk mengetahui informasi selengkapnya, lihat Membuat project.
Membuat kebijakan traffic lintas project
Anda dapat menentukan kebijakan traffic lintas project masuk atau keluar untuk mengelola komunikasi antar-project.
Membuat aturan firewall masuk untuk traffic lintas project
Agar beban kerja atau layanan project mengizinkan koneksi dari beban kerja lain di project lain, Anda harus mengonfigurasi aturan firewall masuk untuk mengizinkan traffic masuk dari beban kerja project lain.
Ikuti langkah-langkah berikut untuk membuat aturan firewall baru dan mengizinkan traffic masuk dari beban kerja di project lain:
Konsol
Di konsol GDC project yang Anda konfigurasi, buka Networking>Firewall di menu navigasi untuk membuka halaman Firewall.
Klik Buat di panel tindakan untuk mulai membuat aturan firewall baru.
Di halaman Detail aturan firewall, isi informasi berikut:
Di kolom Nama, masukkan nama yang valid untuk aturan firewall Anda.
Di bagian Direction of traffic, pilih Ingress untuk mengizinkan traffic masuk dari beban kerja di project lain.
Di bagian Target, pilih salah satu opsi berikut:
Semua beban kerja pengguna: mengizinkan koneksi ke beban kerja project yang Anda konfigurasi.
Layanan: menunjukkan bahwa aturan firewall ini menargetkan layanan tertentu dalam project yang Anda konfigurasi.
Jika target Anda adalah layanan project, pilih nama layanan dari daftar layanan yang tersedia di menu drop-down Layanan.
Di bagian Dari, pilih salah satu dari dua opsi berikut:
Semua project: mengizinkan koneksi dari beban kerja di semua project.
Project lain dan Semua workload pengguna: mengizinkan koneksi dari workload di project lain.
Jika Anda hanya ingin mentransfer beban kerja dari project lain, pilih project yang dapat Anda akses dari daftar project di menu drop-down Project ID.
Jika target Anda adalah semua workload pengguna, pilih salah satu opsi berikut di bagian Protocols and ports:
Izinkan semua: mengizinkan koneksi menggunakan protokol atau port apa pun.
Protokol dan port yang ditentukan: mengizinkan koneksi hanya menggunakan protokol dan port yang Anda tentukan di kolom yang sesuai untuk aturan firewall ingress.
Di halaman Firewall rule details, klik Create.
Anda kini telah mengizinkan koneksi dari workload project lain. Setelah membuat aturan firewall, aturan tersebut akan terlihat dalam tabel di halaman Firewall.
API
Kebijakan berikut memungkinkan workload dalam project PROJECT_1
mengizinkan koneksi dari workload dalam project
PROJECT_2, serta traffic kembali untuk alur yang sama. Terapkan kebijakan:
Ganti API_SERVER dengan jalur kubeconfig server API.
Jika Anda belum membuat file kubeconfig untuk server API, lihat Login untuk mengetahui detailnya.
Perintah sebelumnya mengizinkan PROJECT_2 untuk membuka
PROJECT_1, tetapi tidak mengizinkan koneksi yang dimulai dari
PROJECT_1 ke PROJECT_2. Untuk
kasus terakhir, Anda memerlukan kebijakan timbal balik di project PROJECT_2. Menerapkan
kebijakan timbal balik:
[[["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-09-04 UTC."],[],[],null,["# Create cross-project traffic network policies\n\nThis page provides instructions to configure cross-project traffic network policies in Google Distributed Cloud (GDC) air-gapped appliance.\n\nCross-project traffic refers to the communication between services and workloads from different project namespaces but within the same organization.\n\nServices and workloads in a project are isolated from external services and workloads by default. However, services and workloads from different project namespaces and within the same organization can communicate with each other by applying cross-project traffic network policies.\n\nBefore you begin\n----------------\n\nTo configure intra-project traffic network policies, you must have the following:\n\n- The necessary identity and access roles. For more information, see [Prepare predefined roles and access](/distributed-cloud/hosted/docs/latest/appliance/platform/pa-user/pnp/pnp-overview#prepare-predefined-roles-and-access).\n- An existing project. For more information, see [Create a project](/distributed-cloud/hosted/docs/latest/appliance/platform/pa-user/create-a-project).\n\nCreate a cross-project traffic policy\n-------------------------------------\n\nYou can define ingress or egress cross-project traffic policies to manage the communication between projects.\n\n### Create an ingress firewall rule for cross-project traffic\n\nFor project workloads or services to allow connections from other workloads in another project, you must configure an ingress firewall rule to allow the inbound traffic of other project workloads.\n\nWork through the following steps to create a new firewall rule and allow inbound traffic from workloads in another project: \n\n### Console\n\n1. Within the GDC console of the project you are configuring, go to **Networking** \\\u003e **Firewall** in the navigation menu to open the **Firewall** page.\n2. Click **Create** in the action bar to begin creating a new firewall rule.\n3. On the **Firewall rule details** page, fill out the following information:\n\n 1. In the **Name** field, enter a valid name for your firewall rule.\n 2. In the **Direction of traffic** section, select **Ingress** to allow inbound traffic from workloads in other projects.\n 3. In the **Target** section, select one of the following options:\n - **All user workloads:** allow connections to the workloads of the project you are configuring.\n - **Service:** indicate that this firewall rule targets a specific service within the project you are configuring.\n 4. If your target is a project service, select the name of the service from the list of available services on the **Service** drop-down menu.\n 5. In the **From** section, select one of the following two options:\n - **All projects:** allow connections from workloads in all the projects.\n - **Another project** and **All user workloads:** allow connections from workloads in another project.\n 6. If you want to transfer workloads only from another project, select a project that you can access from the list of projects on the **Project ID** drop-down menu.\n 7. If your target is all user workloads, select one of the following options in the **Protocols and ports** section:\n - **Allow all:** allow connections using any protocol or port.\n - **Specified protocols and ports:** allow connections using only the protocols and ports that you specify in the corresponding fields for the ingress firewall rule.\n4. On the **Firewall rule details** page, click **Create**.\n\nYou've now permitted connections from other project workloads. After creating the firewall rule, the rule is visible in a table on the **Firewall** page.\n\n### API\n\nThe following policy enables workloads in the \u003cvar translate=\"no\"\u003ePROJECT_1\u003c/var\u003e\nproject to permit connections from workloads in the\n\u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e project, as well as the return traffic for\nthe same flows. Apply the policy: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eAPI_SERVER\u003c/var\u003e apply -f - \u003c\u003cEOF\n apiVersion: networking.global.gdc.goog/v1\n kind: ProjectNetworkPolicy\n metadata:\n namespace: \u003cvar translate=\"no\"\u003ePROJECT_1\u003c/var\u003e\n name: allow-inbound-traffic-from-\u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e\n spec:\n policyType: Ingress\n subject:\n subjectType: UserWorkload\n ingress:\n - from:\n - projectSelector:\n projects:\n matchNames:\n - \u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e\n EOF\n\nReplace \u003cvar translate=\"no\"\u003eAPI_SERVER\u003c/var\u003e with the API\nserver's kubeconfig path.\nIf you have not yet generated a kubeconfig file for the API server,\nsee [Sign in](/distributed-cloud/hosted/docs/latest/appliance/platform/pa-user/iam/sign-in#cli) for\ndetails.\n\nThe preceding command allows \u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e to go to\n\u003cvar translate=\"no\"\u003ePROJECT_1\u003c/var\u003e, but doesn't allow connections initiated from\n\u003cvar translate=\"no\"\u003ePROJECT_1\u003c/var\u003e to \u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e. For\nthe latter, you require a reciprocal policy in the\n\u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e project. Apply\nthe reciprocal policy: \n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eAPI_SERVER\u003c/var\u003e apply -f - \u003c\u003cEOF\n apiVersion: networking.global.gdc.goog/v1\n kind: ProjectNetworkPolicy\n metadata:\n namespace: \u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e\n name: allow-inbound-traffic-from-\u003cvar translate=\"no\"\u003ePROJECT_1\u003c/var\u003e\n spec:\n policyType: Ingress\n subject:\n subjectType: UserWorkload\n ingress:\n - from:\n - projectSelector:\n projects:\n matchNames:\n - \u003cvar translate=\"no\"\u003ePROJECT_1\u003c/var\u003e\n EOF\n\nConnections are now permitted to and from\n\u003cvar translate=\"no\"\u003ePROJECT_1\u003c/var\u003e and \u003cvar translate=\"no\"\u003ePROJECT_2\u003c/var\u003e."]]