How to Create & Deploy Kubernetes Engine in GCP
Hello Friends in this article i am gone to share How to Create & Deploy Kubernetes Engine in GCP with you..
Also visit: How to Host Static Website on Google Cloud
How to Create & Deploy Kubernetes Engine in GCP
Follow these steps:
Task 1) Login & setup zone.
Note: our compute zone is an approximate regional location in which your clusters and their resources live. For example, us-central1-a is a zone in the us-central1 region</i >.
Copy this..
gcloud config set compute/zone us-central1-a
Task 2) Create a GKE cluster
2) To create a cluster, run the following command, replacing [CLUSTER-NAME] with the name you choose for the cluster (for example:my-cluster).
gcloud container clusters create [CLUSTER-NAME]
- You can ignore any warnings in the output.
- Wait minutes to finish creating the cluster.
- Check progress to verify the cluster is created successfully or not.
Task 3) Authentication credentials for the cluster
After creating your cluster, you need authentication credentials to interact with it.
To authenticate the cluster, run the following command, replacing [CLUSTER-NAME] with the name of your cluster:
Copy this..
gcloud container clusters get-credentials [CLUSTER-NAME]
Task 4) Deploy an application
- You can now deploy a containerized application to the cluster. For this lab, you’ll run hello-app in your cluster.
- GKE uses Kubernetes objects to create and manage your cluster’s resources. Kubernetes provides the Deployment object for deploying stateless applications like web servers. Service objects define rules and load balancing for accessing your application from the internet.
1) To create a new Deployment hello-server from the hello-app container image, run the following kubectl create command:
kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0
2) To create a Kubernetes Service, which is a Kubernetes resource that lets you expose your application to external traffic, run the following kubectl expose command:
Copy this..
kubectl expose deployment hello-server --type=LoadBalancer --port 8080
kubectl get service
- http://[EXTERNAL-IP]:8080
output:
Task 5: Deleting the cluster
To delete the cluster, run the following command:
gcloud container clusters delete [CLUSTER-NAME]
Note: When prompted, type Y to confirm.
- Deleting the cluster can take a few minutes.
- Check my progress
Congratulations: you successfully Created or Deploy Kubernetes Engine in Google Cloud platform.
Nice Post bro.. please post more articles on GCP
Nicely explained do share more
Nice Article , Do share more articles on Google Cloud.