Site icon Learning & Doing

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

gcloud compute networks subnets list --network default
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'
gcloud compute instances describe source-instance --zone us-central1-a | grep natIP
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
gcloud container clusters get-credentials private-cluster --zone us-central1-a
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.

Exit mobile version