gitkube icon indicating copy to clipboard operation
gitkube copied to clipboard

Unable to push to repo (ssh issue?)

Open rschwabco opened this issue 4 years ago • 3 comments

After following the setup instructions:

kubectl create -f https://raw.githubusercontent.com/hasura/gitkube/master/manifests/gitkube-setup.yaml

#expose gitkubed service
kubectl --namespace kube-system expose deployment gitkubed --type=LoadBalancer --name=gitkubed

I've set this repo up:

apiVersion: gitkube.sh/v1alpha1
kind: Remote
metadata:
  name: my-app-remote
  namespace: default
spec:

# Insert ssh-keys for allowing users to git push
  authorizedKeys:
  - |
    "ssh-rsa AAAA........"  #content of ~/.ssh/id_rsa.pub 

# Provide registry details: https://github.com/hasura/gitkube/blob/master/docs/registry.md
  registry:
    url: "services.azurecr.io"
    credentials:
      secretRef: services-regsecret                # Name of docker-registry secret

# Define deployment rules
  deployments:
  - name: my-app                             # Name of K8s deployment which is updated on git push
    containers: 
    - name: my-app                           # Name of container in the deployment which is built during git push
      path: .                   # Docker build context path in the git repo
      dockerfile: ./Dockerfile  # Location of Dockerfile for the source code

For

kubectl get remote my-app-remote -o yaml

I get

ssh://[email protected]/~/git/default-my-app-remote

I then set up the remote:

git remote add release ssh://[email protected]/~/git/default-my-app-remote

When I push, it failes with

The authenticity of host '40.64.64.125 (40.64.64.125)' can't be established.
ECDSA key fingerprint is SHA256:lOqGRBz/OyFYKwkUbrZrWSAYqWPjPGp1x8moUj9ci18.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What could possibly be going wrong?

rschwabco avatar Jun 10 '20 00:06 rschwabco

Can you edit the SSH key to remove the quotes?

  - |
    "ssh-rsa AAAA........"  #content of ~/.ssh/id_rsa.pub

should be

  - ssh-rsa AAAA........

on a single line

shahidhk avatar Jun 12 '20 10:06 shahidhk

I you wanna do multiline, use

  - |
      ssh-rsa AAAA........

Indentation is important

shahidhk avatar Jun 12 '20 10:06 shahidhk

I had the same issue, it wasn't anything wrong in the yaml. It turned out that gitkubed is not refreshed when adding or changing remotes, so if you add an authorized key you need to restart gitkubed before you can connect.

platy avatar Sep 19 '20 09:09 platy