Google Kubernetes Engine - Create GKE Cluster and Deploy App

Опубликовано: 10 Март 2024
на канале: Cloud Guru
133
7

In this tutorial we will learn some basic docker commands. Create docker image and publish the image to docker container registry. Finally deploy the sample website to Google Kubernetes Engine cluster.

Join WhatsApp: https://www.whatsapp.com/channel/0029...

👉Get CloudWays ➜ https://www.cloudways.com/en/?id=1365224
💥CloudWays COUPON CODE: CLOUDGURU25
☝️☝️ USE THE EXCLUSIVE COUPON CODE ABOVE TO GET 25% OFF FOR 3 MONTHS💥

👉Get Digital Ocean ➜ digitalocean.pxf.io/ZQERvQ
💥Get $200 FREE Credits for signup. So, hurry up!💥

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

Part - 1:
=======
Create a sample website using docker container

docker run -p 8080:80 nginx:latest
docker cp index.html [container-id]:/usr/share/nginx/html/
docker commit [container-id] cad/web:version1
docker tag cad/web:version1 us.gcr.io/youtube-demo-255723/cad-site:version1
docker push us.gcr.io/youtube-demo-255723/cad-site:version1

PART - 2
=======
Deploying container in GKE cluster

gcloud config set project youtube-demo-255723
gcloud config set compute/zone us-central1-a

Creating a GKE cluster

gcloud container clusters create gk-cluster --num-nodes=1
gcloud container clusters get-credentials gk-cluster
This command configures kubectl to use the cluster you created.

Deploying an application to the cluster
kubectl create deployment web-server --image=us.gcr.io/youtube-demo-255723/cad-site:version1

Exposing the Deployment
kubectl expose deployment web-server --type LoadBalancer --port 80 --target-port 80

Inspecting and viewing the application
1. Inspect the running Pods by using
kubectl get pods
2. Inspect the hello-server Service by using
kubectl get service

Sources:

• https://cloud.google.com/container-re...
• https://docs.docker.com/engine/refere...
• https://cloud.google.com/sdk/gcloud/r...
• https://cloud.google.com/kubernetes-e...

#gke #gkecluster #gcp