-
Notifications
You must be signed in to change notification settings - Fork 983
Open
kubernetes/kubernetes
#134263Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.priority/backlogHigher priority than priority/awaiting-more-evidence.Higher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
What happened:
When I ran:
kubectl autoscale -n my-ns deployment my-workload \
--min 1 --max 5 --cpu-percent 50 \
--dry-run=client -o yaml
the generated manifest did not include the namespace field:
metadata:
name: my-workload
What you expected to happen:
The generated YAML should include the metadata.namespace field to reflect the namespace provided in the command, e.g.:
metadata:
name: my-workload
namespace: my-ns
How to reproduce it (as minimally and precisely as possible):
- Create a namespace:
kubectl create namespace my-ns
- Create a deployment in that namespace:
kubectl create deployment my-workload --image=nginx -n my-ns
- Generate an HPA manifest with
--dry-run=client
:
kubectl autoscale -n my-ns deployment my-workload \
--min 1 --max 5 --cpu-percent 50 \
--dry-run=client -o yaml
- Inspect the output:
The generated YAML does not include metadata.namespace, even though -n my-ns was explicitly specified.
Anything else we need to know?:
It happened while I was doing my CKA test. The exam environment uses kubectl version 1.33.
Environment:
- Kubernetes client and server versions (use
kubectl version
): v1.34.1 - v1.34.1+k3s1 - Cloud provider or hardware configuration: Local environment
- OS (e.g:
cat /etc/os-release
): Ubuntu 24.04.2 LTS
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.priority/backlogHigher priority than priority/awaiting-more-evidence.Higher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.