Google Cloud Kubernetes Engine
  1. CNS Policies
  2. GCP Knowledge Base
  3. Google Cloud Kubernetes Engine

Private Endpoint Disabled

Ensure that all Kubernetes clusters have private endpoints enabled.

Risk Level: High

Description

This plugin guarantees that private endpoints are enabled in all GKE clusters. When you create a private cluster, with a private endpoint enabled, it uses a private IP address from your virtual network. This ensures that all the traffic remains within the virtual network.

About the Service

Google Cloud Kubernetes Engine:

The Google Cloud Kubernetes Engine is a Kubernetes-based service that includes a control plane, nodes that house pods, and Google Cloud services. It aids in the modernization of your programs by offering a platform for deploying, managing, and scaling containerized applications. The Google Cloud Console or kubectl can be used to interact with this Google Cloud Kubernetes Engine. To know more, read here

Impact

If the private endpoint is not enabled for your Kubernetes clusters, all traffic between the API server and control plane node pools cannot be routed through a private VPC endpoint. Instead, the public internet will have to use the Kubernetes private endpoints.

Steps to Reproduce

Using GCP Console-

  1. Log In to your GCP Console.
  2. From the top navigation bar, select the GCP project you want to investigate.
  3. From the navigation panel on the left side of the console, go to Kubernetes Engine and select Clusters. You can use this link here to navigate directly if you’re already logged in.
  4. Select the cluster you want to investigate from the list of clusters displayed and go to the Details tab of the selected cluster.
  5. Under the Networking section, check the configuration settings of the properties shown in the screenshot below. If it is different from the screenshot, then the selected cluster does not have a private endpoint enabled.


  6. Repeat steps 4 and 5 for all the clusters you want to investigate in the selected project.
  7. If you have multiple projects that you want to investigate, repeat steps 2 to 6 for each project in your GCP console.

Steps for Remediation

Determine whether or not you truly require the private endpoint to be disabled. If not, make the necessary changes to enable it using the steps given below.

NOTE: This feature cannot be changed once the cluster is made. Hence, to enable it, we must re-create the cluster.

Using GCP Console-

  1. Log In to your GCP Console.
  2. From the top navigation bar, select the GCP project you want to investigate.
  3. From the navigation panel on the left side of the console, go to Kubernetes Engine and select Clusters. You can use this link here to navigate directly if you’re already logged in.
  4. Select the cluster you want to reconfigure from the list of clusters displayed and note down all the configuration details of the selected cluster. (In case you aren’t sure which cluster needs to be configured, follow the steps to reproduce listed above to determine which to choose.)
  5. Click on the Duplicate button found on the top navigation bar.


  6. In the Networking section, choose the Private cluster option.
  7. Enter your desired Control plane IP range in the text box provided and check the confirmation checkbox.


  8. Click CREATE to create the new cluster.
  9. You can now delete the original cluster to avoid unwanted expenses. Click on the cluster and select the DELETE button from the top navigation bar and press DELETE in the pop-up box to confirm the deletion.
  10. Repeat steps 4 to 9 for all the clusters you want to reconfigure in the selected project.
  11. If you have multiple projects, repeat steps 2 to 10 for each project in your GCP console.