Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose gitkube as NodePort type #36

Closed
sdileep opened this issue Mar 24, 2018 · 6 comments
Closed

Expose gitkube as NodePort type #36

sdileep opened this issue Mar 24, 2018 · 6 comments

Comments

@sdileep
Copy link

sdileep commented Mar 24, 2018

I'm trying to experiment with gitkube on a local cluster(not minikube) and hence exposed it as NodePort type service. After creating a remote as per example, I am not able to retrieve the remote URL using $ kubectl get remote example -o json | jq -r '.status.remoteUrl. Am I missing something?

ps: the example worked on GCE without any issues.

@shahidhk
Copy link
Member

@sdileep Can you paste the kubectl command you used to expose gitkube and the the output of kubectl get remote example -o yaml here?

@coco98
Copy link
Contributor

coco98 commented Mar 24, 2018

@shahidhk Once we help @sdileep out, let's add instructions for minikube to our docs too!

@sdileep
Copy link
Author

sdileep commented Mar 24, 2018

@coco98 This is not a minikube environment(mentioned it above). I'm running a couple VMs using VirtualBox and Vagrant. The VMs are on a private network with static IP addresses assigned to them. The cluster was created with kubeadm and kube-dashboard & a sample service for nginx are up and running fine on the cluster

@shahidhk The command that I used was kubectl --kubeconfig <path_to_conf> --namespace kube-system expose deployment gitkubed --type=NodePort --name=gitkubed. The output for the command kubectl get remote example -o yaml` is

apiVersion: gitkube.sh/v1alpha1
kind: Remote
metadata:
  clusterName: ""
  creationTimestamp: 2018-03-24T12:12:02Z
  name: example
  namespace: default
  resourceVersion: "25276"
  selfLink: /apis/gitkube.sh/v1alpha1/namespaces/default/remotes/example
  uid: 8f664f88-2f5c-11e8-8cb2-525400daa710
spec:
  authorizedKeys:
  - ssh-rsa <key>
  - ssh-rsa <AAAAB3NzaC1yc2...  ...zqCcCZT>
    <user@Machine>
  deployments:
  - containers:
    - dockerfile: Dockerfile
      name: nginx
      path: .
    name: nginx

Since I don't have a load balancer, the remote url isn't generated I reckon.

@shahidhk
Copy link
Member

@sdileep Can you try setting this remote manually?

$ git remote add example ssh://default-example@<any-node-id>:<node-port>/~/git/default-example

Also, it'll be helpful if you can paste relevant log lines from gitkube-controller so that we could figure out a fix?

NodePort service objects does not have an external ip field in the spec. Hence gitkube might not be able to figure out the IP. But, this should have been reported as a message in the remote object status.

@tirumaraiselvan
Copy link
Collaborator

tirumaraiselvan commented Mar 25, 2018

kubectl get remote example -o yaml should have had status section. The status will have a remoteUrlDesc which would tell you to add remote manually since it is of type NodePort. This should be fixed by #37

Apart from this, as @shahidhk mentioned, we do not have the external ip for nodeport service in the service object. We can work around this by going through all the nodes and getting the ip of one of the nodes and filling it in the remote. PRs welcome for this.

@sdileep
Copy link
Author

sdileep commented Mar 25, 2018

@shahidhk The logs from the controller are as follows:

time="2018-03-24T14:31:18Z" level=info msg="Setting up event handlers"
time="2018-03-24T14:31:18Z" level=info msg="Initialising gitkube"
time="2018-03-24T14:31:18Z" level=info msg="Waiting for cache sync"
time="2018-03-24T14:31:18Z" level=info msg="Caches are synced"
time="2018-03-24T14:31:18Z" level=info msg="Starting remote worker"
time="2018-03-24T14:31:18Z" level=info msg="Starting configmap worker"
time="2018-03-24T14:31:18Z" level=info msg="Waiting for stop signal"
time="2018-03-24T14:31:18Z" level=info msg="syncing configmap: kube-system.gitkube-ci-conf"
time="2018-03-24T14:31:18Z" level=info msg="syncing configmap: kube-system.gitkube-ci-conf"
time="2018-03-24T17:44:35Z" level=info msg="syncing remote: default.example"

Logs from gitkubed are as follows:

...
Could not load host key: /etc/ssh/ssh_host_dsa_key
Did not receive identification string from 10.1.1.1 port 37504
rexec line 19: Deprecated option KeyRegenerationInterval
rexec line 20: Deprecated option ServerKeyBits
rexec line 31: Deprecated option RSAAuthentication
rexec line 38: Deprecated option RhostsRSAAuthentication
Could not load host key: /etc/ssh/ssh_host_dsa_key
Did not receive identification string from 10.1.1.1 port 37508
rexec line 19: Deprecated option KeyRegenerationInterval
rexec line 20: Deprecated option ServerKeyBits
rexec line 31: Deprecated option RSAAuthentication
rexec line 38: Deprecated option RhostsRSAAuthentication
Could not load host key: /etc/ssh/ssh_host_dsa_key
Did not receive identification string from 10.1.1.1 port 37512
rexec line 19: Deprecated option KeyRegenerationInterval
rexec line 20: Deprecated option ServerKeyBits
rexec line 31: Deprecated option RSAAuthentication
rexec line 38: Deprecated option RhostsRSAAuthentication
Could not load host key: /etc/ssh/ssh_host_dsa_key
Did not receive identification string from 10.1.1.1 port 37516
rexec line 19: Deprecated option KeyRegenerationInterval
rexec line 20: Deprecated option ServerKeyBits
rexec line 31: Deprecated option RSAAuthentication
rexec line 38: Deprecated option RhostsRSAAuthentication
...

^^ those logs seems to keep repeating for every 4th port

@shahidhk thanks for the git remote url, the one from the example doc is not correct. This solves the issue for me.

@sdileep sdileep closed this as completed Mar 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants