Skip to content

Warn Users of Region Before Executing kubectl Commands #1727

Closed
@Divakar-Raju

Description

@Divakar-Raju

What would you like to be added:
Currently, kubectl does not provide any warning regarding which Kubernetes cluster or cloud region the command is being executed on. This can lead to accidental modifications in the wrong environment (e.g., production instead of staging or wrong region ).

Add an interactive warning before executing any kubectl apply, delete, patch, replace, taint, exec, create, run commands, displaying the current region and asking for user confirmation before proceeding.

Example :

$ kubectl apply -f deployment.yaml
WARNING: You are making changes in region us-east-1 (Cluster: prod-cluster).
Do you want to continue? (yes/no): 

This ensures users are aware of the region and cluster before proceeding.

Why is this needed:
Prevents accidental changes in production clusters.
Helps users working across multiple environments in difference regions
Enhances safety in cloud-based Kubernetes deployments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions