Friday, November 15, 2024
GCP Kubernetes

Setting up a Private Kubernetes Cluster

private

“Setting up a Private Kubernetes Cluster”

Pengantar

Di Kubernetes Engine, cluster pribadi adalah cluster yang membuat master Anda tidak dapat diakses dari internet publik. Dalam cluster pribadi, node tidak memiliki alamat IP publik, hanya alamat pribadi, sehingga beban kerja Anda berjalan di lingkungan yang terisolasi. Node dan master berkomunikasi satu sama lain menggunakan peering VPC.

Set a zone

gcloud config set compute/zone us-central1-a

Buat private cluster

gcloud beta container clusters create private-cluster \
    --enable-private-nodes \
    --master-ipv4-cidr 172.16.0.16/28 \
    --enable-ip-alias \
    --create-subnetwork ""

Viewing your subnet and secondary address ranges

  • cek list subnet
gcloud compute networks subnets list --network default
  • cek info subnet
gcloud compute networks subnets describe [SUBNET_NAME] --region us-central1

Enabling master authorized networks

gcloud compute instances create source-instance --zone us-central1-a --scopes 'https://www.googleapis.com/auth/cloud-platform'
  • Cek external IP
gcloud compute instances describe source-instance --zone us-central1-a | grep natIP
  • authorize external address
gcloud container clusters update private-cluster \
    --enable-master-authorized-networks \
    --master-authorized-networks [MY_EXTERNAL_RANGE]
gcloud compute ssh source-instance --zone us-central1-a
gcloud components install kubectl
  • Buat cluster
gcloud container clusters get-credentials private-cluster --zone us-central1-a
  • cek node
kubectl get nodes --output yaml | grep -A4 addresses

Clean Up

gcloud container clusters delete private-cluster --zone us-central1-a

Penutup

Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Setting up a Private Kubernetes Cluster. Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.

(Visited 199 times, 1 visits today)
Baca Juga :  Cara Membuat OS Mikrotik CHR di Google Cloud Platform 2021

Similar Posts