NEG ไฮบริดแบบไฮบริดของ Looker PSC ไปยังภายในองค์กร

1. บทนำ

ใน Codelab นี้ คุณจะทำการเชื่อมต่อขาออกกับฐานข้อมูล Postgres ในองค์กรผ่าน H-VPN โดยใช้ตัวจัดสรรภาระงานพร็อกซี TCP ภายในและกลุ่มปลายทางเครือข่ายแบบไฮบริดที่เรียกใช้จาก Looker PSC ในฐานะผู้ใช้บริการ

Private Service Connect เป็นความสามารถของเครือข่าย Google Cloud ที่ช่วยให้ผู้บริโภคเข้าถึงบริการที่มีการจัดการแบบส่วนตัวจากภายในเครือข่าย VPC ของตนเองได้ ในทำนองเดียวกัน ก็ช่วยให้ผู้ให้บริการที่มีการจัดการโฮสต์บริการเหล่านี้ในเครือข่าย VPC ของตนเองแยกต่างหาก และเสนอการเชื่อมต่อส่วนตัวแก่ผู้บริโภคได้ ตัวอย่างเช่น เมื่อใช้ Private Service Connect เพื่อเข้าถึง Looker คุณจะเป็นผู้ใช้บริการ และ Google จะเป็นผู้ให้บริการ ดังที่ไฮไลต์ไว้ในรูปที่ 1

รูปที่ 1

145ea4672c3a3b14.png

การเข้าถึง Southbound หรือที่เรียกว่า PSC แบบย้อนกลับช่วยให้ผู้ใช้สร้างบริการที่เผยแพร่เป็นผู้ให้บริการเพื่ออนุญาตให้ Looker เข้าถึงปลายทางในองค์กร ใน VPC ไปยังบริการที่มีการจัดการ และแบบไฮบริด การเชื่อมต่อขาออกสามารถติดตั้งใช้งานได้ในทุกภูมิภาค ไม่ว่า Looker PSC จะติดตั้งใช้งานอยู่ที่ใด ดังที่ไฮไลต์ในรูปที่ 2

รูปที่ 2

259493afd914f68b.png

สิ่งที่คุณจะได้เรียนรู้

  • ข้อกำหนดเกี่ยวกับเครือข่าย
  • สร้างบริการของผู้ผลิต Private Service Connect
  • สร้างปลายทาง Private Service Connect ใน Looker
  • สร้างการเชื่อมต่อกับฐานข้อมูล Postgres ในองค์กรจาก Looker โดยใช้การทดสอบการเชื่อมต่อ

สิ่งที่คุณต้องมี

def88091b42bfe4d.png

2. สิ่งที่คุณจะสร้าง

คุณจะสร้างเครือข่ายผู้ผลิต looker-psc-demo เพื่อติดตั้งใช้งานตัวจัดสรรภาระงาน TCP Proxy ภายในและ Hybrid NEG ที่เผยแพร่เป็นบริการผ่าน Private Service Connect (PSC) หากต้องการสาธิตฐานข้อมูลในองค์กร คุณจะต้องติดตั้งใช้งาน VPC ในองค์กรที่เชื่อมต่อกับ VPC ของ looker-psc-demo โดยใช้ HA-VPN

คุณจะดำเนินการต่อไปนี้เพื่อตรวจสอบสิทธิ์เข้าถึงบริการ Producer

  • สร้างปลายทาง PSC ใน Looker ที่เชื่อมโยงกับไฟล์แนบเกี่ยวกับบริการของผู้ผลิต
  • ใช้ Looker Console เพื่อทำการตรวจสอบการเชื่อมต่อกับฐานข้อมูล Postgres ในองค์กร

3. ข้อกำหนดเกี่ยวกับเครือข่าย

ด้านล่างนี้คือรายละเอียดข้อกำหนดของเครือข่ายสำหรับเครือข่าย Producer โดยผู้บริโภคใน Codelab นี้คืออินสแตนซ์ PSC ของ Looker

คอมโพเนนต์

คำอธิบาย

VPC (looker-psc-demo)

VPC โหมดที่กำหนดเอง

VPC (on-prem-demo)

VPC โหมดที่กำหนดเอง

ซับเน็ต NAT ของ PSC

ระบบจะแปลแพ็กเก็ตจากเครือข่าย VPC ของผู้บริโภคโดยใช้ Source NAT (SNAT) เพื่อแปลงที่อยู่ IP ต้นทางเดิมเป็นที่อยู่ IP ต้นทางจากซับเน็ต NAT ในเครือข่าย VPC ของผู้ผลิต

ซับเน็ตของกฎการส่งต่อ PSC

ใช้เพื่อจัดสรรที่อยู่ IP สำหรับตัวจัดสรรภาระงาน TCP Proxy ภายในระดับภูมิภาค

ซับเน็ต PSC NEG

ใช้เพื่อจัดสรรที่อยู่ IP สำหรับกลุ่มปลายทางเครือข่าย

ซับเน็ตเฉพาะพร็อกซี

พร็อกซี ของตัวจัดสรรภาระงานแต่ละรายการจะได้รับที่อยู่ IP ภายใน แพ็กเกตที่ส่งจากพร็อกซีไปยัง VM หรือปลายทางแบ็กเอนด์จะมีที่อยู่ IP ต้นทางจากเครือข่ายย่อยเฉพาะพร็อกซี

NEG แบบไฮบริด

ระบบจะถือว่าบริการในองค์กรและบริการระบบคลาวด์อื่นๆ เป็นเหมือนแบ็กเอนด์ของ Cloud Load Balancing อื่นๆ ความแตกต่างที่สำคัญคือคุณใช้ NEG การเชื่อมต่อแบบไฮบริดเพื่อกำหนดค่าปลายทางของแบ็กเอนด์เหล่านี้ ปลายทางต้องเป็นชุดค่าผสม IP:พอร์ตที่ถูกต้องซึ่งตัวจัดสรรภาระงานเข้าถึงได้โดยใช้ผลิตภัณฑ์การเชื่อมต่อแบบไฮบริด เช่น Cloud VPN หรือ Cloud Interconnect

บริการแบ็กเอนด์

บริการแบ็กเอนด์ทำหน้าที่เป็นสะพานเชื่อมระหว่างตัวจัดสรรภาระงานกับทรัพยากรแบ็กเอนด์ ในบทแนะนำนี้ บริการแบ็กเอนด์จะเชื่อมโยงกับ Hybrid NEG

Cloud Router

  • Cloud NAT อาศัยเราเตอร์ระบบคลาวด์ สำหรับความสามารถของ Control Plane แต่ไม่ใช่สำหรับการจัดการเซสชัน BGP
  • Cloud Router ใช้สำหรับ BGP ที่สร้างขึ้นเพื่อการสร้าง HA-VPN ระหว่าง VPC ของ psc-looker-demo กับ on-prem-demo

HA-VPN

VPN ความพร้อมใช้งานสูงระหว่างเครือข่าย VPC ของ Google Cloud ในโทโพโลยีนี้ คุณสามารถเชื่อมต่อเครือข่าย Google Cloud VPC 2 เครือข่ายได้โดยใช้เกตเวย์ VPN ความพร้อมใช้งานสูงในแต่ละเครือข่าย เครือข่าย VPC อาจอยู่ในภูมิภาคเดียวกันหรือหลายภูมิภาคก็ได้

Cloud NAT

ใช้โดย VPC ของการสาธิตในองค์กรสำหรับการออกอินเทอร์เน็ต

4. โทโพโลยี Codelab

79aeb28b38f237da.png

5. การตั้งค่าและข้อกำหนด

การตั้งค่าสภาพแวดล้อมแบบเรียนรู้ด้วยตนเอง

  1. ลงชื่อเข้าใช้ คอนโซล Google Cloud แล้วสร้างโปรเจ็กต์ใหม่หรือใช้โปรเจ็กต์ที่มีอยู่ซ้ำ หากยังไม่มีบัญชี Gmail หรือ Google Workspace คุณต้องสร้างบัญชี

fbef9caa1602edd0.pnga99b7ace416376c4.png5e3ff691252acf41.png

  • ชื่อโปรเจ็กต์คือชื่อที่แสดงสำหรับผู้เข้าร่วมโปรเจ็กต์นี้ ซึ่งเป็นสตริงอักขระที่ Google APIs ไม่ได้ใช้ คุณอัปเดตได้ทุกเมื่อ
  • รหัสโปรเจ็กต์จะไม่ซ้ำกันในโปรเจ็กต์ Google Cloud ทั้งหมดและเปลี่ยนแปลงไม่ได้ (เปลี่ยนไม่ได้หลังจากตั้งค่าแล้ว) Cloud Console จะสร้างสตริงที่ไม่ซ้ำกันโดยอัตโนมัติ ซึ่งโดยปกติแล้วคุณไม่จำเป็นต้องสนใจว่าสตริงนั้นคืออะไร ใน Codelab ส่วนใหญ่ คุณจะต้องอ้างอิงรหัสโปรเจ็กต์ (โดยทั่วไปจะระบุเป็น PROJECT_ID) หากไม่ชอบรหัสที่สร้างขึ้น คุณอาจสร้างรหัสแบบสุ่มอีกรหัสหนึ่งได้ หรือคุณจะลองใช้ชื่อของคุณเองและดูว่าชื่อนั้นพร้อมใช้งานหรือไม่ก็ได้ คุณจะเปลี่ยนแปลงรหัสนี้หลังจากขั้นตอนนี้ไม่ได้ และรหัสจะคงอยู่ตลอดระยะเวลาของโปรเจ็กต์
  • โปรดทราบว่ายังมีค่าที่ 3 ซึ่งก็คือหมายเลขโปรเจ็กต์ที่ API บางตัวใช้ ดูข้อมูลเพิ่มเติมเกี่ยวกับค่าทั้ง 3 นี้ได้ในเอกสารประกอบ
  1. จากนั้นคุณจะต้องเปิดใช้การเรียกเก็บเงินใน Cloud Console เพื่อใช้ทรัพยากร/API ของ Cloud การทำตาม Codelab นี้จะไม่เสียค่าใช้จ่ายมากนัก หรืออาจไม่เสียเลย หากต้องการปิดทรัพยากรเพื่อหลีกเลี่ยงการเรียกเก็บเงินนอกเหนือจากบทแนะนำนี้ คุณสามารถลบทรัพยากรที่สร้างขึ้นหรือลบโปรเจ็กต์ได้ ผู้ใช้ Google Cloud รายใหม่มีสิทธิ์เข้าร่วมโปรแกรมช่วงทดลองใช้ฟรีมูลค่า$300 USD

เริ่มต้น Cloud Shell

แม้ว่าคุณจะใช้งาน Google Cloud จากระยะไกลในแล็ปท็อปได้ แต่ใน Codelab นี้คุณจะใช้ Google Cloud Shell ซึ่งเป็นสภาพแวดล้อมบรรทัดคำสั่งที่ทำงานในระบบคลาวด์

จาก คอนโซล Google Cloud ให้คลิกไอคอน Cloud Shell ในแถบเครื่องมือด้านขวาบน

55efc1aaa7a4d3ad.png

การจัดสรรและเชื่อมต่อกับสภาพแวดล้อมจะใช้เวลาเพียงไม่กี่นาที เมื่อเสร็จแล้ว คุณควรเห็นข้อความคล้ายกับตัวอย่างต่อไปนี้

7ffe5cbb04455448.png

เครื่องเสมือนนี้มาพร้อมเครื่องมือพัฒนาซอฟต์แวร์ทั้งหมดที่คุณต้องการ โดยมีไดเรกทอรีหลักแบบถาวรขนาด 5 GB และทำงานบน Google Cloud ซึ่งช่วยเพิ่มประสิทธิภาพเครือข่ายและการตรวจสอบสิทธิ์ได้อย่างมาก คุณสามารถทำงานทั้งหมดใน Codelab นี้ได้ภายในเบราว์เซอร์ คุณไม่จำเป็นต้องติดตั้งอะไร

6. ก่อนเริ่มต้น

เปิดใช้ API

ใน Cloud Shell ให้ตรวจสอบว่าได้ตั้งค่ารหัสโปรเจ็กต์แล้ว

gcloud config list project
gcloud config set project [YOUR-PROJECT-ID]
project=[YOUR-PROJECT-ID]
region=[YOUR-REGION]
zone=[YOUR-ZONE]
echo $project
echo $region

เปิดใช้บริการที่จำเป็นทั้งหมด

gcloud services enable compute.googleapis.com

7. สร้างเครือข่าย VPC ของผู้ผลิต

เครือข่าย VPC

ใน Cloud Shell ให้ทำดังนี้

gcloud compute networks create looker-psc-demo --subnet-mode custom

สร้างซับเน็ต

ซับเน็ต PSC จะเชื่อมโยงกับไฟล์แนบของบริการ PSC เพื่อวัตถุประสงค์ในการเปลี่ยนค่าที่อยู่เครือข่าย

สร้างซับเน็ต NAT ของ PSC ใน Cloud Shell โดยทำดังนี้

gcloud compute networks subnets create producer-psc-nat-subnet --network looker-psc-demo --range 172.16.10.0/28 --region $region --purpose=PRIVATE_SERVICE_CONNECT

สร้างซับเน็ตของกฎการส่งต่อสำหรับผู้ผลิตภายใน Cloud Shell โดยทำดังนี้

gcloud compute networks subnets create producer-psc-fr-subnet --network looker-psc-demo --range 172.16.20.0/28 --region $region --enable-private-ip-google-access

สร้างซับเน็ตเฉพาะพร็อกซีระดับภูมิภาคของผู้ผลิตภายใน Cloud Shell โดยใช้คำสั่งต่อไปนี้

gcloud compute networks subnets create $region-proxy-only-subnet \
  --purpose=REGIONAL_MANAGED_PROXY \
  --role=ACTIVE \
  --region=$region \
  --network=looker-psc-demo \
  --range=10.10.10.0/24

สำรองที่อยู่ IP ของตัวจัดสรรภาระงาน

ใน Cloud Shell ให้จองที่อยู่ IP ภายในสำหรับตัวจัดสรรภาระงานโดยทำดังนี้

gcloud compute addresses create hybrid-neg-lb-ip \
  --region=$region \
  --subnet=producer-psc-fr-subnet

ดูที่อยู่ IP ที่สงวนไว้ภายใน Cloud Shell

gcloud compute addresses describe hybrid-neg-lb-ip \
  --region=$region | grep -i address:

ตัวอย่างเอาต์พุต

gcloud compute addresses describe hybrid-neg-lb-ip   --region=$region | grep -i address:
address: 172.16.20.2

ตั้งค่า NEG แบบผสม

สร้าง NEG แบบไฮบริด และตั้งค่า –network-endpoint-type เป็น NON_GCP_PRIVATE_IP_PORT

ใน Cloud Shell ให้สร้าง Hybrid NEG ที่ใช้เพื่อเข้าถึงฐานข้อมูลภายในองค์กร

gcloud compute network-endpoint-groups create on-prem-hybrid-neg \
    --network-endpoint-type=NON_GCP_PRIVATE_IP_PORT \
    --network=looker-psc-demo \
    --zone=$zone

ใน Cloud Shell ให้อัปเดต Hybrid NEG ด้วย IP:Port ของฐานข้อมูลในองค์กร 192.168.10.4 และพอร์ต 5432 ซึ่งสร้างขึ้นในขั้นตอนต่อๆ ไปของบทแนะนำ

gcloud compute network-endpoint-groups update on-prem-hybrid-neg \
    --add-endpoint=ip=192.168.10.4,port=5432 \
    --zone=$zone

สร้างการตรวจสอบประสิทธิภาพการทำงานระดับภูมิภาค

สร้างการตรวจสอบประสิทธิภาพการทำงานที่ตรวจสอบพอร์ตฐานข้อมูลในองค์กร 5432 ภายใน Cloud Shell

gcloud compute health-checks create tcp on-prem-5432-healthcheck \
    --region=$region \
    --port=5432

สร้างนโยบายไฟร์วอลล์เครือข่ายและกฎไฟร์วอลล์

ใน Cloud Shell ให้ทำดังนี้

gcloud compute network-firewall-policies create looker-psc-demo-policy --global

gcloud compute network-firewall-policies associations create --firewall-policy looker-psc-demo-policy --network looker-psc-demo --name looker-psc-demo --global-firewall-policy

กฎไฟร์วอลล์ต่อไปนี้อนุญาตการรับส่งข้อมูลจากช่วงซับเน็ต NAT ของ PSC ไปยังอินสแตนซ์ทั้งหมดในเครือข่าย

ใน Cloud Shell ให้ทำดังนี้

gcloud compute network-firewall-policies rules create 2001 --action ALLOW --firewall-policy looker-psc-demo-policy --description "allow traffic from PSC NAT subnet" --direction INGRESS --src-ip-ranges 172.16.10.0/28 --global-firewall-policy --layer4-configs=tcp

8. สร้างบริการของผู้ผลิต

สร้างคอมโพเนนต์ของตัวจัดสรรภาระงาน

สร้างบริการแบ็กเอนด์ภายใน Cloud Shell โดยทำดังนี้

gcloud compute backend-services create producer-backend-svc --region=$region --load-balancing-scheme=INTERNAL_MANAGED --protocol=TCP --region=$region --health-checks=on-prem-5432-healthcheck --health-checks-region=$region

ใน Cloud Shell ให้เพิ่มแบ็กเอนด์ Hybrid NEG ลงในบริการแบ็กเอนด์โดยทำดังนี้

gcloud compute backend-services add-backend producer-backend-svc --network-endpoint-group=on-prem-hybrid-neg --network-endpoint-group-zone=$zone --balancing-mode=CONNECTION --max-connections=100 --region=$region

ใน Cloud Shell ให้สร้างพร็อกซี TCP เป้าหมายเพื่อกำหนดเส้นทางการรับส่งข้อมูลไปยังบริการแบ็กเอนด์

gcloud compute target-tcp-proxies create producer-lb-tcp-proxy \
      --backend-service=producer-backend-svc  \
      --region=$region

ในไวยากรณ์ต่อไปนี้ ให้สร้างกฎการส่งต่อ (ตัวจัดสรรภาระงานพร็อกซี TCP ภายใน)

ใน Cloud Shell ให้ทำดังนี้

gcloud compute forwarding-rules create producer-hybrid-neg-fr \
     --load-balancing-scheme=INTERNAL_MANAGED \
     --network-tier=PREMIUM \
     --network=looker-psc-demo \
     --subnet=producer-psc-fr-subnet \
     --address=hybrid-neg-lb-ip \
     --target-tcp-proxy=producer-lb-tcp-proxy \
     --target-tcp-proxy-region=$region \
     --region=$region \
     --ports=5432

สร้าง Service Attachment

สร้างไฟล์แนบบริการ onpremdatabase1-svc-attachment ใน Cloud Shell ดังนี้

gcloud compute service-attachments create onpremdatabase1-svc-attachment --region=$region --producer-forwarding-rule=producer-hybrid-neg-fr --connection-preference=ACCEPT_AUTOMATIC --nat-subnets=producer-psc-nat-subnet

จากนั้นรับและจดบันทึกการเชื่อมต่อบริการที่แสดงใน URI ของ selfLink ซึ่งเริ่มต้นด้วยโปรเจ็กต์เพื่อกำหนดค่าปลายทาง PSC ใน Looker

selfLink: projects/<your-project-id>/regions/<your-region>/serviceAttachments/onpremdatabase1-svc-attachment

ใน Cloud Shell ให้ทำดังนี้

gcloud compute service-attachments describe onpremdatabase1-svc-attachment --region=$region

ตัวอย่างผลลัพธ์ที่คาดหวัง

connectionPreference: ACCEPT_AUTOMATIC
creationTimestamp: '2024-09-01T16:07:51.600-07:00'
description: ''
enableProxyProtocol: false
fingerprint: cFt9rERR1iE=
id: '2549689544315850024'
kind: compute#serviceAttachment
name: onpremdatabase1-svc-attachment
natSubnets:
- https://www.googleapis.com/compute/v1/projects/$project/regions/$region/subnetworks/producer-psc-nat-subnet
pscServiceAttachmentId:
  high: '19348441121424360'
  low: '2549689544315850024'
reconcileConnections: false
region: https://www.googleapis.com/compute/v1/projects/$project/regions/$region
selfLink: https://www.googleapis.com/compute/v1/projects/$project/regions/$region/serviceAttachments/onpremdatabase1-svc-attachment
targetService: https://www.googleapis.com/compute/v1/projects/$project/regions/$region/forwardingRules/producer-hybrid-neg-fr

ใน Cloud Console ให้ไปที่

บริการเครือข่าย → Private Service Connect → บริการที่เผยแพร่

9f436251a3ae2cc7.png4c3e8e73d40d1238.png

9. สร้างการเชื่อมต่อปลายทาง PSC ใน Looker

ในส่วนต่อไปนี้ คุณจะเชื่อมโยงการแนบบริการของผู้ผลิตกับ PSC หลักของ Looker ผ่านการใช้แฟล็ก -psc-service-attachment ใน Cloud Shell สำหรับโดเมนเดียว

ใน Cloud Shell ให้สร้างการเชื่อมโยง PSC โดยอัปเดตพารามิเตอร์ต่อไปนี้ให้ตรงกับสภาพแวดล้อมของคุณ

  • INSTANCE_NAME: ชื่ออินสแตนซ์ Looker (Google Cloud Core)
  • DOMAIN_1: onprem.database1.com
  • SERVICE_ATTACHMENT_1: URI ที่บันทึกไว้เมื่อสร้างไฟล์แนบบริการใน onpremdatabase1-svc-attachment
  • REGION: ภูมิภาคที่โฮสต์อินสแตนซ์ Looker (Google Cloud Core)

ใน Cloud Shell ให้ทำดังนี้

gcloud looker instances update INSTANCE_NAME \
--psc-service-attachment  domain=DOMAIN_1,attachment=SERVICE_ATTACHMENT_URI_1 \
--region=REGION

ตัวอย่าง

gcloud looker instances update looker-psc-instance --psc-service-attachment domain=onprem.database1.com,attachment=projects/$project/regions/$region/serviceAttachments/onpremdatabase1-svc-attachment --region=$region

ใน Cloud Shell ให้ตรวจสอบว่า connectionStatus ของ serviceAttachments เป็น "ACCEPTED" แล้วอัปเดตด้วยชื่ออินสแตนซ์ PSC ของ Looker

gcloud looker instances describe [INSTANCE_NAME] --region=$region --format=json

ตัวอย่าง

gcloud looker instances describe looker-psc-instance --region=$region --format=json

ตัวอย่าง

{
  "adminSettings": {},
  "createTime": "2024-08-23T00:00:45.339063195Z",
  "customDomain": {
    "domain": "looker.cosmopup.com",
    "state": "AVAILABLE"
  },
  "encryptionConfig": {},
  "lookerVersion": "24.14.18",
  "name": "projects/$project/locations/$region/instances/looker-psc-instance",
  "platformEdition": "LOOKER_CORE_ENTERPRISE_ANNUAL",
  "pscConfig": {
    "allowedVpcs": [
      "projects/$project/global/networks/looker-psc-demo",
      "projects/$project/global/networks/looker-shared-vpc"
    ],
    "lookerServiceAttachmentUri": "projects/t7ec792caf2a609d1-tp/regions/$region/serviceAttachments/looker-psc-f51982e2-ac0d-48b1-91bb-88656971c183",
    "serviceAttachments": [
      {
        "connectionStatus": "ACCEPTED",
        "localFqdn": "onprem.database1.com",
        "targetServiceAttachmentUri": "projects/$project/regions/$region/serviceAttachments/onpremdatabase1-svc-attachment"
      }
    ]
  },
  "pscEnabled": true,
  "state": "ACTIVE",
  "updateTime": "2024-09-01T23:15:07.426372901Z"
}

ตรวจสอบความถูกต้องของปลายทาง PSC ใน Cloud Console

คุณสามารถตรวจสอบการเชื่อมต่อ PSC จาก Cloud Console ได้

ใน Cloud Console ให้ไปที่

Looker → อินสแตนซ์ Looker → รายละเอียด

2d4684d722d31e4b.png993cdaf748f4c030.png

สร้างเครือข่าย VPC ในองค์กร

เครือข่าย VPC

ใน Cloud Shell ให้ทำดังนี้

gcloud compute networks create on-prem-demo --project=$project --subnet-mode=custom

สร้างซับเน็ตฐานข้อมูล Postgresql

ใน Cloud Shell ให้ทำดังนี้

gcloud compute networks subnets create database-subnet --project=$project --range=192.168.10.0/28 --network=on-prem-demo --region=$region

ใน Cloud Shell ให้สำรองที่อยู่ IPv4 ภายในที่ใช้สำหรับ onprem.database1.com, 192.168.10.4 โดยทำดังนี้

gcloud compute addresses create on-prem-database1-ip --region=$region --subnet=database-subnet --addresses 192.168.10.4

สร้าง Cloud Router สำหรับ VPC ของ on-prem-demo

ในบทแนะนำนี้จะใช้ Cloud NAT สำหรับการติดตั้งแพ็กเกจซอฟต์แวร์เนื่องจากอินสแตนซ์ VM ไม่มีที่อยู่ IP ภายนอก

สร้าง Cloud Router ที่ใช้กับ Cloud NAT และ HA-VPN ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers create on-prem-cr \
   --region=$region \
   --network=on-prem-demo \
   --asn=65002

สร้างเกตเวย์ NAT ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers nats create on-prem-nat --router=on-prem-cr --auto-allocate-nat-external-ips --nat-all-subnet-ip-ranges --region $region

สร้างอินสแตนซ์ทดสอบฐานข้อมูล

สร้างอินสแตนซ์ฐานข้อมูล Postgres ที่จะใช้ทดสอบและตรวจสอบการเชื่อมต่อกับ Looker

สร้างอินสแตนซ์ภายใน Cloud Shell โดยทำดังนี้

gcloud compute instances create postgres-database \
    --project=$project \
    --zone=$zone \
    --machine-type=e2-medium \
    --subnet=database-subnet \
    --no-address \
    --private-network-ip 192.168.10.4 \
    --image-family debian-12 \
    --image-project debian-cloud  \
    --metadata startup-script="#! /bin/bash
      sudo apt-get update
      sudo apt -y install postgresql postgresql-client postgresql-contrib -y"

สร้างนโยบายไฟร์วอลล์เครือข่ายและกฎไฟร์วอลล์

ใน Cloud Shell ให้ทำดังนี้

gcloud compute network-firewall-policies create on-prem-demo-policy --global

gcloud compute network-firewall-policies associations create --firewall-policy on-prem-demo-policy --network on-prem-demo --name on-prem-demo --global-firewall-policy

หากต้องการอนุญาตให้ IAP เชื่อมต่อกับอินสแตนซ์ VM ให้สร้างกฎไฟร์วอลล์ที่มีลักษณะดังนี้

  • มีผลกับอินสแตนซ์ VM ทั้งหมดที่คุณต้องการให้เข้าถึงได้โดยใช้ IAP
  • อนุญาตการรับส่งข้อมูลขาเข้าจากช่วง IP 35.235.240.0/20 ช่วงนี้มีที่อยู่ IP ทั้งหมดที่ IAP ใช้สำหรับการส่งต่อ TCP

ใน Cloud Shell ให้ทำดังนี้

gcloud compute network-firewall-policies rules create 1000 --action ALLOW --firewall-policy on-prem-demo-policy --description "SSH with IAP" --direction INGRESS --src-ip-ranges 35.235.240.0/20 --layer4-configs tcp:22  --global-firewall-policy

กฎไฟร์วอลล์ต่อไปนี้อนุญาตให้มีการรับส่งข้อมูลจากช่วงซับเน็ตเฉพาะพร็อกซีไปยังอินสแตนซ์ทั้งหมดในเครือข่าย

ใน Cloud Shell ให้ทำดังนี้

gcloud compute network-firewall-policies rules create 2001 --action ALLOW --firewall-policy on-prem-demo-policy --description "allow traffic from proxy only subnet" --direction INGRESS --src-ip-ranges 10.10.10.0/24 --global-firewall-policy --layer4-configs=tcp

10. การเชื่อมต่อแบบผสม

ในส่วนต่อไปนี้ คุณจะสร้าง Cloud Router ที่ช่วยให้แลกเปลี่ยนเส้นทางแบบไดนามิกระหว่าง Virtual Private Cloud (VPC) กับเครือข่ายเพียร์ได้โดยใช้ Border Gateway Protocol (BGP)

Cloud Router สามารถตั้งค่าเซสชัน BGP ผ่านอุโมงค์ Cloud VPN เพื่อเชื่อมต่อเครือข่ายของคุณ โดยจะเรียนรู้ช่วงที่อยู่ IP ของซับเน็ตใหม่โดยอัตโนมัติและประกาศช่วงดังกล่าวไปยังเครือข่ายเพียร์

ในขั้นตอนต่อไปนี้ คุณจะติดตั้งใช้งาน HA VPN ระหว่าง VPC ของ looker-psc-demo กับ VPC ของ on-prem-demo เพื่อสาธิตการเชื่อมต่อ NEG แบบไฮบริดกับ onprem.database1.com

สร้าง VPN ความพร้อมใช้งานสูง GW สำหรับ looker-psc-demo

เมื่อสร้างเกตเวย์แต่ละรายการ ระบบจะจัดสรรที่อยู่ IPv4 ภายนอก 2 รายการโดยอัตโนมัติ ซึ่งเป็นที่อยู่สำหรับอินเทอร์เฟซของเกตเวย์แต่ละรายการ

สร้าง VPN ความพร้อมใช้งานสูง GW ภายใน Cloud Shell โดยทำดังนี้

gcloud compute vpn-gateways create looker-psc-demo-vpn-gw \
   --network=looker-psc-demo \
   --region=$region

สร้าง HA VPN GW สำหรับ on-prem-demo

เมื่อสร้างเกตเวย์แต่ละรายการ ระบบจะจัดสรรที่อยู่ IPv4 ภายนอก 2 รายการโดยอัตโนมัติ ซึ่งเป็นที่อยู่สำหรับอินเทอร์เฟซของเกตเวย์แต่ละรายการ

สร้าง VPN ความพร้อมใช้งานสูง GW ภายใน Cloud Shell โดยทำดังนี้

gcloud compute vpn-gateways create on-prem-vpn-gw \
   --network=on-prem-demo\
   --region=$region

ตรวจสอบการสร้างเกตเวย์ VPN ความพร้อมใช้งานสูง

ใช้คอนโซลเพื่อไปที่การเชื่อมต่อแบบไฮบริด → VPN → เกตเวย์ Cloud VPN

7f1b504616504866.png

สร้าง Cloud Router สำหรับ looker-psc-demo

สร้าง Cloud Router ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers create looker-psc-demo-cr \
   --region=$region \
   --network=looker-psc-demo\
   --asn=65001

สร้างอุโมงค์ข้อมูล VPN สำหรับ looker-psc-demo

คุณจะสร้างอุโมงค์ข้อมูล VPN 2 รายการในเกตเวย์ VPN ความพร้อมใช้งานสูงแต่ละรายการ

สร้างอุโมงค์ข้อมูล VPN0

สร้าง tunnel0 ภายใน Cloud Shell โดยใช้คำสั่งต่อไปนี้

gcloud compute vpn-tunnels create looker-psc-demo-tunnel0 \
    --peer-gcp-gateway on-prem-vpn-gw \
    --region $region \
    --ike-version 2 \
    --shared-secret [ZzTLxKL8fmRykwNDfCvEFIjmlYLhMucH] \
    --router looker-psc-demo-cr \
    --vpn-gateway looker-psc-demo-vpn-gw \
    --interface 0

สร้างอุโมงค์ข้อมูล VPN1

สร้าง tunnel1 ภายใน Cloud Shell โดยใช้คำสั่งต่อไปนี้

gcloud compute vpn-tunnels create looker-psc-demo-tunnel1 \
    --peer-gcp-gateway on-prem-vpn-gw \
    --region $region \
    --ike-version 2 \
    --shared-secret [bcyPaboPl8fSkXRmvONGJzWTrc6tRqY5] \
    --router looker-psc-demo-cr \
    --vpn-gateway looker-psc-demo-vpn-gw \
    --interface 1

สร้างอุโมงค์ข้อมูล VPN สำหรับ on-prem-demo

คุณจะสร้างอุโมงค์ข้อมูล VPN 2 รายการในเกตเวย์ VPN ความพร้อมใช้งานสูงแต่ละรายการ

สร้างอุโมงค์ข้อมูล VPN0

สร้าง tunnel0 ภายใน Cloud Shell โดยใช้คำสั่งต่อไปนี้

gcloud compute vpn-tunnels create on-prem-tunnel0 \
    --peer-gcp-gateway looker-psc-demo-vpn-gw \
    --region $region \
    --ike-version 2 \
    --shared-secret [ZzTLxKL8fmRykwNDfCvEFIjmlYLhMucH] \
    --router on-prem-cr \
    --vpn-gateway on-prem-vpn-gw \
   --interface 0

สร้างอุโมงค์ข้อมูล VPN1

สร้าง tunnel1 ภายใน Cloud Shell โดยใช้คำสั่งต่อไปนี้

gcloud compute vpn-tunnels create on-prem-tunnel1 \
    --peer-gcp-gateway looker-psc-demo-vpn-gw \
    --region $region \
    --ike-version 2 \
    --shared-secret [bcyPaboPl8fSkXRmvONGJzWTrc6tRqY5] \
    --router on-prem-cr \
    --vpn-gateway on-prem-vpn-gw \
    --interface 1

ตรวจสอบการสร้างอุโมงค์ข้อมูล VPN

ใช้คอนโซลเพื่อไปที่การเชื่อมต่อแบบไฮบริด → VPN → อุโมงค์ข้อมูล Cloud VPN

c2fcb340a7614070.png

11. สร้างเพื่อนบ้าน BGP

สร้างอินเทอร์เฟซ BGP และการ Peering สำหรับ looker-psc-demo

สร้างอินเทอร์เฟซ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-interface looker-psc-demo-cr \
    --interface-name if-tunnel0-to-onprem \
    --ip-address 169.254.1.1 \
    --mask-length 30 \
    --vpn-tunnel looker-psc-demo-tunnel0 \
    --region $region

สร้างเพียร์ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-bgp-peer looker-psc-demo-cr \
    --peer-name bgp-on-premises-tunnel0 \
    --interface if-tunnel1-to-onprem \
    --peer-ip-address 169.254.1.2 \
    --peer-asn 65002 \
    --region $region

สร้างอินเทอร์เฟซ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-interface looker-psc-demo-cr \
    --interface-name if-tunnel1-to-onprem \
    --ip-address 169.254.2.1 \
    --mask-length 30 \
    --vpn-tunnel looker-psc-demo-tunnel1 \
    --region $region

สร้างเพียร์ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-bgp-peer looker-psc-demo-cr \
    --peer-name bgp-on-premises-tunnel1 \
    --interface if-tunnel2-to-onprem \
    --peer-ip-address 169.254.2.2 \
    --peer-asn 65002 \
    --region $region

สร้างอินเทอร์เฟซ BGP และการ Peering สำหรับ on-prem-demo

สร้างอินเทอร์เฟซ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-interface on-prem-cr \
    --interface-name if-tunnel0-to-looker-psc-demo \
    --ip-address 169.254.1.2 \
    --mask-length 30 \
    --vpn-tunnel on-prem-tunnel0 \
    --region $region

สร้างเพียร์ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-bgp-peer on-prem-cr \
    --peer-name bgp-looker-psc-demo-tunnel0 \
    --interface if-tunnel1-to-looker-psc-demo \
    --peer-ip-address 169.254.1.1 \
    --peer-asn 65001 \
    --region $region

สร้างอินเทอร์เฟซ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-interface on-prem-cr \
    --interface-name if-tunnel1-to-looker-psc-demo \
    --ip-address 169.254.2.2 \
    --mask-length 30 \
    --vpn-tunnel on-prem-tunnel1 \
    --region $region

สร้างเพียร์ BGP ภายใน Cloud Shell โดยทำดังนี้

gcloud compute routers add-bgp-peer on-prem-cr \
    --peer-name bgp-looker-psc-demo-tunnel1\
    --interface if-tunnel2-to-looker-psc-demo \
    --peer-ip-address 169.254.2.1 \
    --peer-asn 65001 \
    --region $region

ไปที่การเชื่อมต่อแบบไฮบริด → VPN เพื่อดูรายละเอียดอุโมงค์ข้อมูล VPN

78ab590317919bf5.png

ตรวจสอบเส้นทางที่ Looker-psc-demo เรียนรู้ผ่าน VPN ความพร้อมใช้งานสูง

เมื่อสร้างอุโมงค์ VPN ความพร้อมใช้งานสูง และเซสชัน BGP แล้ว ลักษณะการทำงานเริ่มต้นของ Cloud Router คือการโฆษณาเส้นทางซับเน็ต ดูเส้นทางที่เรียนรู้ของ looker-psc-demo

ใช้คอนโซลเพื่อไปที่เครือข่าย VPC → เครือข่าย VPC → looker-psc-demo → เส้นทาง → ภูมิภาค → ดู

สังเกตว่า looker-psc-demo ได้เรียนรู้ subnet ฐานข้อมูล 192.168.10.0/28 จาก VPC on-prem-demo

c11a11ed8b0491c8.png

ตรวจสอบว่า VPC ของ on-prem-demo ได้เรียนรู้เส้นทางผ่าน HA VPN

เนื่องจากลักษณะการทำงานเริ่มต้นของ Cloud Router คือการกระจายข้อมูลซับเน็ตทั้งหมด ระบบจึงกระจายข้อมูลซับเน็ตของพร็อกซีเท่านั้นผ่าน BGP NEG แบบไฮบริดจะใช้ซับเน็ตพร็อกซีเท่านั้นเป็นที่อยู่ต้นทางเมื่อสื่อสารกับเซิร์ฟเวอร์ onprem.database1.com

สังเกตว่า on-prem-demo ได้เรียนรู้ซับเน็ตเฉพาะพร็อกซี 10.10.10.0/24 จาก looker-psc-demo

ใช้คอนโซลเพื่อไปที่เครือข่าย VPC → เครือข่าย VPC → on-prem-demo → เส้นทาง → ภูมิภาค → ดู

b0073faed026931f.png

12. การสร้างฐานข้อมูล Postgres ของ Looker

ในส่วนต่อไปนี้ คุณจะ SSH ไปยัง VM ฐานข้อมูล postgres โดยใช้ Cloud Shell

ใน Cloud Shell ให้ใช้ ssh ไปยังอินสแตนซ์ postgres-database** ดังนี้

 gcloud compute ssh --zone "$zone" "postgres-database" --project "$project"

ในระบบปฏิบัติการ ให้ระบุและจดที่อยู่ IP (ens4) ของอินสแตนซ์ postgres-database

ip a

ตัวอย่าง

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc mq state UP group default qlen 1000
    link/ether 42:01:c0:a8:0a:04 brd ff:ff:ff:ff:ff:ff
    altname enp0s4
    inet 192.168.10.4/32 metric 100 scope global dynamic ens4
       valid_lft 66779sec preferred_lft 66779sec
    inet6 fe80::4001:c0ff:fea8:a04/64 scope link 
       valid_lft forever preferred_lft forever

เข้าสู่ระบบ postgresql ในระบบปฏิบัติการโดยทำดังนี้

sudo -u postgres psql postgres

ภายในระบบปฏิบัติการ ให้ป้อนพรอมต์รหัสผ่าน:

\password postgres

ในระบบปฏิบัติการ ให้ตั้งรหัสผ่านเป็น postgres (ป้อนรหัสผ่านเดียวกัน 2 ครั้ง)

postgres

ตัวอย่าง

user@postgres-database:~$ sudo -u postgres psql postgres
\password postgres
psql (13.11 (Debian 13.11-0+deb11u1))
Type "help" for help.
postgres=# \password postgres
Enter new password for user "postgres": 
Enter it again: 

ออกจาก postgres ในระบบปฏิบัติการโดยทำดังนี้

\q

ตัวอย่าง

postgres=# \q
user@postgres-database:~$ 

ในส่วนต่อไปนี้ คุณจะแทรก IP ของอินสแตนซ์ postgres-database (192.168.10.4) และซับเน็ตพร็อกซีเท่านั้น (10.10.10.0/24) ในไฟล์ pg_hba.conf ภายใต้การเชื่อมต่อภายใน IPv4

sudo nano /etc/postgresql/15/main/pg_hba.conf

ภาพหน้าจอด้านล่างแสดงการอัปเดตที่เสร็จสมบูรณ์แล้ว eaff2ed6d27fa7cc.png

ในส่วนต่อไปนี้ ให้ยกเลิกการแสดงความคิดเห็นใน postgresql.conf เพื่อฟังที่อยู่ IP ทั้งหมด "*" ตามภาพหน้าจอด้านล่าง

sudo nano /etc/postgresql/15/main/postgresql.conf

ก่อน:

65e0b1074dc48644.png

หลัง:

14a0d1fa5455e23e.png

ภายในระบบปฏิบัติการ ให้รีสตาร์ทบริการ postgresql โดยทำดังนี้

sudo service postgresql restart

ภายในระบบปฏิบัติการ ให้ตรวจสอบว่าสถานะของ postgresql เป็น "ใช้งานอยู่"

sudo service postgresql status

ตัวอย่าง

ภายในระบบปฏิบัติการ ให้ตรวจสอบว่าสถานะของ postgresql เป็น "ใช้งานอยู่"

user@postgres-database:/$ sudo service postgresql status
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; preset: enabled)
     Active: active (exited) since Mon 2024-09-02 12:10:10 UTC; 1min 46s ago
    Process: 20486 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 20486 (code=exited, status=0/SUCCESS)
        CPU: 2ms

Sep 02 12:10:10 postgres-database systemd[1]: Starting postgresql.service - PostgreSQL RDBMS...
Sep 02 12:10:10 postgres-database systemd[1]: Finished postgresql.service - PostgreSQL RDBMS.

13. สร้างฐานข้อมูล Postgres

ในส่วนต่อไปนี้ คุณจะสร้างฐานข้อมูล Postgres ชื่อ postgres_looker และสคีมา looker_schema ที่ใช้เพื่อตรวจสอบการเชื่อมต่อ Looker กับการเชื่อมต่อในองค์กร

เข้าสู่ระบบ postgres ในระบบปฏิบัติการโดยใช้คำสั่งต่อไปนี้

sudo -u postgres psql postgres

สร้างฐานข้อมูลภายในระบบปฏิบัติการโดยทำดังนี้

create database postgres_looker;

ภายในระบบปฏิบัติการ ให้แสดงรายการฐานข้อมูลดังนี้

\l

สร้างผู้ใช้ postgres_looker ด้วยรหัสผ่าน postgreslooker ในระบบปฏิบัติการ

create user postgres_looker with password 'postgreslooker';

ภายในระบบปฏิบัติการ ให้เชื่อมต่อกับฐานข้อมูลโดยทำดังนี้

\c postgres_looker;

สร้างสคีมา looker-schema ภายในระบบปฏิบัติการ แล้วออกไปยังพรอมต์ Cloud Shell

create schema looker_schema;
create table looker_schema.test(firstname CHAR(15), lastname CHAR(20));
exit

Exit from the OS, returning you to cloud shell:

\q

ตัวอย่าง

user@postgres-database:/$ sudo -u postgres psql postgres
psql (15.8 (Debian 15.8-0+deb12u1))
Type "help" for help.

postgres=# create database postgres_looker;
CREATE DATABASE
postgres=# \l
                                                List of databases
      Name       |  Owner   | Encoding | Collate |  Ctype  | ICU Locale | Locale Provider |   Access privileges   
-----------------+----------+----------+---------+---------+------------+-----------------+-----------------------
 postgres        | postgres | UTF8     | C.UTF-8 | C.UTF-8 |            | libc            | 
 postgres_looker | postgres | UTF8     | C.UTF-8 | C.UTF-8 |            | libc            | 
 template0       | postgres | UTF8     | C.UTF-8 | C.UTF-8 |            | libc            | =c/postgres          +
                 |          |          |         |         |            |                 | postgres=CTc/postgres
 template1       | postgres | UTF8     | C.UTF-8 | C.UTF-8 |            | libc            | =c/postgres          +
                 |          |          |         |         |            |                 | postgres=CTc/postgres
(4 rows)

postgres=# create user postgres_looker with password 'postgreslooker';
CREATE ROLE
postgres=# \c postgres_looker;
You are now connected to database "postgres_looker" as user "postgres".
postgres_looker=# create schema looker_schema;
create table looker_schema.test(firstname CHAR(15), lastname CHAR(20));
exit
CREATE SCHEMA
CREATE TABLE
postgres_looker-# \q

14. ผสานรวม Looker กับฐานข้อมูล Postgres

ในส่วนต่อไปนี้ คุณจะใช้ Looker Console เพื่อสร้างการเชื่อมต่อฐานข้อมูลกับอินสแตนซ์ฐานข้อมูล postgres ในองค์กร

ไปที่ผู้ดูแลระบบ → ฐานข้อมูล → การเชื่อมต่อ → เลือกเพิ่มการเชื่อมต่อ

กรอกรายละเอียดการเชื่อมต่อตามภาพหน้าจอด้านล่าง แล้วเลือกเชื่อมต่อ

5900fdf0b698cbfc.png

ตอนนี้กำหนดค่าการเชื่อมต่อแล้ว

4817157fd3b1277e.png

15. ตรวจสอบการเชื่อมต่อ Looker

ในส่วนต่อไปนี้ คุณจะได้เรียนรู้วิธีตรวจสอบการเชื่อมต่อ Looker กับฐานข้อมูล Postgres ใน on-prem-vpc โดยใช้การดำเนินการ "ทดสอบ" ของ Looker และ TCPDUMP

จาก Cloud Shell ให้เข้าสู่ระบบฐานข้อมูล postgres หากเซสชันหมดเวลา

ใน Cloud Shell ให้ทำดังนี้

gcloud config list project
gcloud config set project [YOUR-PROJECT-ID]
project=[YOUR-PROJECT-ID]
region=[YOUR-REGION]
zone=[YOUR-ZONE]
echo $project
echo $region
gcloud compute ssh --zone "$zone" "postgres-database" --project "$project"

สร้างตัวกรอง TCPDUMP จากระบบปฏิบัติการด้วยซับเน็ตเฉพาะพร็อกซี 10.10.10.0/24

sudo tcpdump -i any net 10.10.10.0/24 -nn

ไปที่การเชื่อมต่อข้อมูล ADMIN → DATABASE → CONNECTIONS → postgres-database → Test

เมื่อเลือก "ทดสอบ" แล้ว Looker จะเชื่อมต่อกับฐานข้อมูล Postgres ตามที่ระบุไว้ด้านล่าง

774f9313ece41034.png

ล้างข้อมูล

ลบคอมโพเนนต์ของ Lab จากเทอร์มินัล Cloud Shell เดียว

gcloud compute service-attachments delete onpremdatabase1-svc-attachment --region=$region -q

gcloud compute forwarding-rules delete producer-hybrid-neg-fr --region=$region -q

gcloud compute target-tcp-proxies delete producer-lb-tcp-proxy --region=$region -q

gcloud compute backend-services delete producer-backend-svc --region=$region -q

gcloud compute network-firewall-policies rules delete 2001 --firewall-policy looker-psc-demo-policy --global-firewall-policy -q

gcloud compute network-firewall-policies associations delete --firewall-policy=looker-psc-demo-policy  --name=looker-psc-demo --global-firewall-policy -q

gcloud compute network-firewall-policies delete looker-psc-demo-policy --global -q

gcloud compute routers nats delete on-prem-nat --router=on-prem-cr --router-region=$region -q

gcloud compute network-endpoint-groups delete on-prem-hybrid-neg --zone=$zone -q

gcloud compute addresses delete hybrid-neg-lb-ip --region=$region -q

gcloud compute vpn-tunnels delete looker-psc-demo-tunnel0 looker-psc-demo-tunnel1 on-prem-tunnel0 on-prem-tunnel1 --region=$region -q

gcloud compute vpn-gateways delete looker-psc-demo-vpn-gw on-prem-vpn-gw --region=$region -q

gcloud compute routers delete looker-psc-demo-cr on-prem-cr --region=$region -q

gcloud compute instances delete postgres-database --zone=$zone -q

gcloud compute addresses delete on-prem-database1-ip --region=$region -q

gcloud compute networks subnets delete database-subnet --region=$region -q

gcloud compute network-firewall-policies rules delete 2001 --firewall-policy on-prem-demo-policy --global-firewall-policy -q

gcloud compute network-firewall-policies rules delete 1000 --firewall-policy on-prem-demo-policy --global-firewall-policy -q

gcloud compute network-firewall-policies associations delete --firewall-policy=on-prem-demo-policy  --name=on-prem-demo --global-firewall-policy -q

gcloud compute networks subnets delete $region-proxy-only-subnet --region=$region -q

gcloud compute networks subnets delete producer-psc-nat-subnet --region=$region -q

gcloud compute networks subnets delete producer-psc-fr-subnet --region=$region -q

gcloud compute networks delete on-prem-demo -q

gcloud compute networks delete looker-psc-demo -q

16. ขอแสดงความยินดี

ขอแสดงความยินดี คุณได้กำหนดค่าและตรวจสอบการเชื่อมต่อกับฐานข้อมูลในองค์กรผ่าน HA-VPN โดยใช้ Looker Console ที่ขับเคลื่อนโดย Private Service Connect เรียบร้อยแล้ว

คุณได้สร้างโครงสร้างพื้นฐานของผู้ให้บริการ เรียนรู้วิธีสร้าง Hybrid NEG, บริการของผู้ให้บริการ และปลายทาง Looker PSC ที่อนุญาตการเชื่อมต่อกับบริการของผู้ให้บริการ

Cosmopup คิดว่า Codelab ยอดเยี่ยมมาก!!

c911c127bffdee57.jpeg

สิ่งต่อไปที่ควรทำ

ลองใช้ Codelab เหล่านี้

อ่านเพิ่มเติมและวิดีโอ

เอกสารอ้างอิง