A new version of GKE on AWS was released on October 2. See the release notes for more information.


This topic shows you how to create a workload on GKE on AWS and expose it internally to your cluster.

Before you begin

Before you start using GKE on AWS, make sure you have performed the following tasks:

  • Install a management service.
  • Create a user cluster.
  • From your anthos-aws directory, use anthos-gke to switch context to your user cluster.
    cd anthos-aws
    env HTTP_PROXY=http://localhost:8118 \
    anthos-gke aws clusters get-credentials CLUSTER_NAME

Launch an NGINX deployment

In this section, you create a deployment of the NGINX webserver named my-nginx.

  1. Use kubectl create to create the deployment.

    env HTTP_PROXY=http://localhost:8118 \
    kubectl create deployment --image nginx my-nginx
  2. Use kubectl to get the status of the deployment. Note the Pod's NAME.

    env HTTP_PROXY=http://localhost:8118 \
    kubectl get deployment

Exposing your pods

This section shows how to expose the deployment internally in your cluster and use kubectl port-forward to open a tunnel from the Deployment to your local machine.

  1. Expose the Deployment to the cluster with kubectl expose.

    env HTTP_PROXY=http://localhost:8118 \
    kubectl expose deployment my-nginx --port=80

    The deployment is now accessible from within the cluster.

  2. Forward port 80 in the Deployment to port 8080 on your local machine with kubectl port-forward.

    env HTTP_PROXY=http://localhost:8118 \
    kubectl port-forward deployment/my-nginx 8080:80
  3. Connect to http://localhost:8080 with curl or your web browser. The default NGINX web page appears.

    curl http://localhost:8080

View your deployment on Google Cloud Console

If your cluster is connected to Google Cloud Console, you can view your deployment in the GKE Workloads page. To view your workload, perform the following steps:

  1. In your browser, visit the Google Kubernetes Engine Workloads page.

    Visit the Google Kubernetes Engine Workloads page

    The list of Workloads appears.

  2. Click the name of your workload, my-nginx. The Deployment details screen appears.

  3. From this screen, you can get details on your deployment; view and edit YAML configuration; and take other Kubernetes actions.

For more information on options available from this page, see Deploying a stateless application in the GKE documentation.


To delete the your NGINX deployment, use kubectl delete:

env HTTP_PROXY=http://localhost:8118 \
kubectl delete service my-nginx &&\
kubectl delete deployment my-nginx

What's next?

Create an externally-facing deployment using a load balancer or Ingress.

You can use other types of Kubernetes Workloads with GKE on AWS. See the GKE documentation for more information on Deploying workloads.