kubernetes / kubernetes/kubectl
Ability To Send Custom Headers From kubectl
- Dominant language
- Go
- Stars
- 3.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
### What would you like to be added?
It would be nice to have the option to pass along custom headers from kubectl to the k8s api. This would allow for more security options to be used, possibly tracing options or monitoring options as well.
Thinking it could look something like
```
kubectl get pods --customheader foo:bar --customheader far:bar
```
It should work with any command as it would need to be global, since any api call could possibly need the custom header ability.
It could also be an option in the kubeconfig per cluster. That way it would not need to be set every single command.
### Why is this needed?
It's a best practice to lock down the k8s api, via networking layer, and not run it on the public internet. This requires the api to either have a firewall on it that only allows traffic from specific IPs or to be internal to a network and then some proxy is required to reach it externally, which is typically locked down to IPs as well.
If we had the ability to pass custom headers, we could use zero trust security products that could front the api and then allow much stronger identity based access to the API. This would allow for multi factor auth on k8s API, by locking down the API to only users that need access to it, then on top of that, k8s based authn/z. Allowing for both factors of security is a good way to prevent zero day issues effecting your api. This also allows for k8s to be fully supported by zero trust solutions.
Contributor guide
Research direction
Start with kubectl's global command options and kubeconfig per-cluster settings, then trace how commands send requests to the Kubernetes API. Establish how repeated custom headers and configured headers should be represented, and verify that they apply consistently to every API-calling command without changing existing authentication behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, cli, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100