In the Google Cloud console navigation menu, click Kubernetes Engine.
On the Create an Autopilot cluster page, do the following:
- In the Name field, enter
my-autopilot-cluster
. - In the Region field, select
us-central1
. - Click Create.
This operation might take some time to complete.
To open Cloud Shell, click Cloud Shell button
This operation might take some time to complete.
Clone the sample app from GitHub:
git clone https://github.com/GoogleCloudPlatform/microservices-demo.git
Open the directory with the sample code on Cloud Shell Editor:
cloudshell workspace microservices-demo
This operation might take some time to complete.
To add a GKE cluster, do the following:
-
In the View menu, click Command Palette.
-
Enter add cluster, and then click Add a Cluster to the KubeConfig.
-
Select Google Kubernetes Engine.
This operation might take some time to complete.
Once available, select my-autopilot-cluster us-central1.
You new GKE cluster appears in the Clusters section. To check the status of your cluster, click Bell button.
In the Terminal menu, select New Terminal.
Deploy the application to your cluster:
kubectl apply -f ./release/kubernetes-manifests.yaml
The output is similar to the following:
deployment.apps/adservice created
service/adservice created
In the integrated terminal, get the external IP address of the service:
kubectl get services
Record the external IP address for the frontend-external Service. You need it later.
You might need to wait several minutes before the service’s external IP address populates. If the application’s external IP is pending, run kubectl get services
again.
In a web browser, enter the address for your application: http://EXTERNAL-IP
Replace EXTERNAL-IP with the external IP address copied in the previous step. You have successfully deployed a sample app to GKE in Autopilot.