aylei / kubectl-debug

This repository is no longer maintained, please checkout https://github.com/JamesTGrant/kubectl-debug.
Apache License 2.0
2.31k stars 303 forks source link

`RegistrySecretName` inf config file don't work #139

Open zhangguanzhang opened 3 years ago

zhangguanzhang commented 3 years ago

config file:

$ 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:

$ 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#
andrey-gava commented 3 years ago

Have the same problem. Plus agentless: false in config didn't work too on both last version, including rc.

qianzhang613 commented 3 years ago

Have the same problem. +1