Triage and Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration of enabling Kubernetes Web UI on GCP, you can follow the below steps using the GCP console:
- Open the GCP console and navigate to the Kubernetes Engine page.
- Select the cluster that you want to remediate.
- Click on the “Actions” drop-down menu and select “Edit”.
- Scroll down to the “Add-ons” section and click on the “Disabled” radio button for the “Kubernetes Dashboard” option.
- Click on the “Save” button at the bottom of the page to save the changes.
- Wait for a few minutes for the changes to take effect.
Using CLI
Using CLI
To remediate the misconfiguration of ensuring Kubernetes Web UI is disabled in GCP, you can follow the below steps using GCP CLI:
- Open the Cloud Shell in the GCP Console.
-
Run the following command to get the status of the Kubernetes Web UI:
This command will list all the deployments in the
kube-system
namespace. -
Check if
kubernetes-dashboard
deployment is present in the output of the above command. If it is present, then the Kubernetes Web UI is enabled. -
Run the following command to delete the
kubernetes-dashboard
deployment:This command will delete thekubernetes-dashboard
deployment from thekube-system
namespace. -
Verify that the
kubernetes-dashboard
deployment is deleted by running the following command:This command should not list thekubernetes-dashboard
deployment. -
Run the following command to delete the Kubernetes Web UI service:
This command will delete the Kubernetes Web UI service from the
kube-system
namespace. -
Verify that the Kubernetes Web UI service is deleted by running the following command:
This command should not list the
kubernetes-dashboard
service. -
Finally, run the following command to verify that the Kubernetes Web UI is disabled:
This command should not list the Kubernetes Web UI endpoint.
Using Python
Using Python
To remediate the misconfiguration “Ensure Kubernetes Web UI Is Disabled” for GCP using python, you can follow these steps:Note: Make sure to replace
- Open the Cloud Shell in your GCP console.
-
Install the required Python libraries:
google-auth
andgoogle-cloud-resource-manager
. -
Set the project ID where the Kubernetes cluster is running:
PROJECT_ID=<your-project-id>
-
Set the name of the Kubernetes cluster:
CLUSTER_NAME=<your-cluster-name>
- Run the following Python code to disable Kubernetes Web UI:
<your-project-id>
, <your-cluster-name>
, and KEY_PATH
with your own values before running the code.- Verify that Kubernetes Web UI is disabled by accessing the Kubernetes dashboard URL. You should see an error message indicating that the dashboard is not available.