aylei / aylei/kubectl-debug

`RegistrySecretName` inf config file don't work

Open
#139 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
303
PR merge metrics
No merged PRs in 30d

Description

config file:
```shell
$ cat ~/.kube/debug-config
agentImage: xxx.lan:5000/debug-agent:latest
debugAgentNamespace: kube-system
agentless: true
image: xxx:5000/netshoot:latest
RegistrySecretName: regcred
RegistrySecretNamespace: default
```
if run without `--registry-secret-name`
```
$ kubectl debug xxxx-core-84c57974dd-w9w4j bash
2021/02/01 12:35:10 Getting user name from default context 'xxx'
2021/02/01 12:35:10 User name 'admin' received from context
Agent Pod info: [Name:debug-agent-pod-de65ed93-6446-11eb-bd48-00505692ae0c, Namespace:default, Image:xxx.lan:5000/debug-agent:latest, HostPort:10027, ContainerPort:10027]
Waiting for pod debug-agent-pod-de65ed93-6446-11eb-bd48-00505692ae0c to run...
Forwarding from 127.0.0.1:10027 -> 10027
Forwarding from [::1]:10027 -> 10027
Handling connection for 10027
Start deleting agent pod xxxx-core-84c57974dd-w9w4j
error execute remote, Internal error occurred: error attaching to container: Error response from daemon: Get http://xxx.lan:5000/v2/netshoot/manifests/latest: no basic auth credentials
error: Internal error occurred: error attaching to container: Error response from daemon: Get http://xxx.lan:5000/v2/netshoot/manifests/latest: no basic auth credentials
```
if run with `--registry-secret-name`:
```shell
$ kubectl debug xxxx-core-84c57974dd-w9w4j --registry-secret-name regcred
2021/02/01 14:01:23 Getting user name from default context 'xxx'
2021/02/01 14:01:23 User name 'admin' received from context
Agent Pod info: [Name:debug-agent-pod-e9ea4a34-6452-11eb-9017-00505692ae0c, Namespace:default, Image:xxx.lan:5000/debug-agent:latest, HostPort:10027, ContainerPort:10027]
Waiting for pod debug-agent-pod-e9ea4a34-6452-11eb-9017-00505692ae0c to run...
Forwarding from 127.0.0.1:10027 -> 10027
Forwarding from [::1]:10027 -> 10027
Handling connection for 10027
container created, open tty...
bash-5.0#
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the command with ~/.kube/debug-config, comparing its RegistrySecretName and RegistrySecretNamespace values with the explicit --registry-secret-name flag. Trace the configuration path and confirm that running kubectl debug with the file alone uses the registry secret successfully, matching the flag-based behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.