Coder created workspace (from K8s Devcontainer template) does not seem to inject proper SSH key

Hi i need some help setting up Coder on a K8s cluster. I've installed coder in K8s (via helm), configured role and role binding for PVC and Deployments. Setting up a workspace from the k8S DevContainer template seems working fine except that ssh keys are not properly injected into the workspace, resulting in git clone failure. Below are the logs. Really appreciate any help!
envbuilder v1.1.0+a3a6a83 - Build development environments from repositories in a container
#1: ๐Ÿ“ฆ Cloning [email protected]:zhenzhongxu/personal-ai-infra.git to /workspaces/personal-ai-infra...
#1: ๐Ÿ”‘ Using SSH authentication!
#1: ๐Ÿ”‘ No SSH key found, falling back to agent!
#1: โŒ Failed to connect to SSH agent: error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
#1: Parsed Git URL as "ssh://[email protected]/zhenzhongxu/personal-ai-infra.git"
Failed to clone repository: clone "[email protected]:zhenzhongxu/personal-ai-infra.git": error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
envbuilder v1.1.0+a3a6a83 - Build development environments from repositories in a container
#1: ๐Ÿ“ฆ Cloning [email protected]:zhenzhongxu/personal-ai-infra.git to /workspaces/personal-ai-infra...
#1: ๐Ÿ”‘ Using SSH authentication!
#1: ๐Ÿ”‘ No SSH key found, falling back to agent!
#1: โŒ Failed to connect to SSH agent: error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
#1: Parsed Git URL as "ssh://[email protected]/zhenzhongxu/personal-ai-infra.git"
Failed to clone repository: clone "[email protected]:zhenzhongxu/personal-ai-infra.git": error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
GitHub
coder/examples/templates/kubernetes-devcontainer at main ยท coder/co...
Provision remote development environments via Terraform - coder/coder
7 Replies
Codercord
Codercordโ€ข2w ago
<#1317422891666505739>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Zhenzhong Xu
Zhenzhong XuOPโ€ข2w ago
Curious question, is the Coder agent running in the workspace pod actually passes SSH keys as mentioned here. If so, what's the mechanism? Attaching some logs below.
Secrets | Coder Docs
Use sensitive variables in your workspaces
From An unknown user
From An unknown user
Zhenzhong Xu
Zhenzhong XuOPโ€ข2w ago
Zhenzhong Xu
Zhenzhong XuOPโ€ข2w ago
Seems like the coder agent (inside workspace) returns error on coder gitssh command, is this a bug?
coder@coder-7f668cfd-1bd6-4ee7-92e7-3416ef8b376e-6746758f4d-hzsxs:/workspaces$ /tmp/coder.vuXpAJ/coder gitssh --
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address]
[-c cipher_spec] [-D [bind_address:]port] [-E log_file]
[-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file]
[-J destination] [-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-P tag] [-p port] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
destination [command [argument ...]]
ssh [-Q query_option]

Coder authenticates with git using the public
key below. All clones with SSH are authenticated automatically ๐Ÿช„.

ssh-ed25519 AAAA_[REDACTED]_

Add to GitHub and GitLab:
https://github.com/settings/ssh/new

https://gitlab.com/-/profile/keys


Encountered an error running "coder gitssh", see "coder gitssh --help" for more information

coder@coder-7f668cfd-1bd6-4ee7-92e7-3416ef8b376e-6746758f4d-hzsxs:/tmp$ coder gitssh [email protected]
PTY allocation request failed on channel 0
Hi zhenzhongxu! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
Encountered an error running "coder gitssh", see "coder gitssh --help" for more information
error: run ssh command: exit status 1
error: exit status 255
coder@coder-7f668cfd-1bd6-4ee7-92e7-3416ef8b376e-6746758f4d-hzsxs:/workspaces$ /tmp/coder.vuXpAJ/coder gitssh --
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address]
[-c cipher_spec] [-D [bind_address:]port] [-E log_file]
[-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file]
[-J destination] [-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-P tag] [-p port] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
destination [command [argument ...]]
ssh [-Q query_option]

Coder authenticates with git using the public
key below. All clones with SSH are authenticated automatically ๐Ÿช„.

ssh-ed25519 AAAA_[REDACTED]_

Add to GitHub and GitLab:
https://github.com/settings/ssh/new

https://gitlab.com/-/profile/keys


Encountered an error running "coder gitssh", see "coder gitssh --help" for more information

coder@coder-7f668cfd-1bd6-4ee7-92e7-3416ef8b376e-6746758f4d-hzsxs:/tmp$ coder gitssh [email protected]
PTY allocation request failed on channel 0
Hi zhenzhongxu! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
Encountered an error running "coder gitssh", see "coder gitssh --help" for more information
error: run ssh command: exit status 1
error: exit status 255
Zhenzhong Xu
Zhenzhong XuOPโ€ข2w ago
I found this doc, and it solved my problem. Please feel free to ignore the thread.
GitHub
envbuilder/docs/git-auth.md at main ยท coder/envbuilder
Build development environments from a Dockerfile on Docker, Kubernetes, and OpenShift. Enable developers to modify their development environment quickly. - coder/envbuilder
Phorcys
Phorcysโ€ข2w ago
hey @Zhenzhong Xu, thanks for being so detailed! will close this down as you've figured it out :-)
Codercord
Codercordโ€ข2w ago
@Phorcys closed the thread.

Did you find this page helpful?