0

I'm a complete newbie with Kubernetes, and have been trying to get secure CockroachDB running. I'm using the instructions and preconfigured .yaml files provided by Cockroach. https://www.cockroachlabs.com/docs/stable/orchestrate-cockroachdb-with-kubernetes.html

I'm using the Cloud Shell in my Google Cloud console to set everything up. Everything goes well, and I can do local SQL tests and load data. Monitoring the cluster by proxying to localhost, with the comnmand below starts off serving as expected

kubectl port-forward cockroachdb-0 8080

However, when using cloud shell web preview on port 8080 to attach to localhost, the browser session returns "too many redirects".

My next challenge will be to figure out how to expose the cluster on a public address, but for now I'm stuck on what seems to be a fairly basic problem. Any advice would be greatly appreciated.

bruce
  • 1,408
  • 11
  • 33
  • 2
    I don't seem to be able to use port-forward from the cloud shell at all, but if I do it locally it works fine. Is it a solution for you to install kubernetes and gcloud cli's locally? – Dries De Rydt Feb 06 '18 at 12:55
  • I probably could do something with a VM, but I'm using a chromebook and would rather use the cloud shell as all my data conversion work is all being done there. Have you been able to expose an external cluster ip? I could do that instead of local host. – bruce Feb 06 '18 at 13:26
  • 3
    yeah sure, you can use kubectl expose pod cockroachdb-0 --port=8080 --type=LoadBalancer Then it can take a while, but kubectl get svc should show you an external IP. (will be pending at first) – Dries De Rydt Feb 06 '18 at 13:27
  • Many thanks!! - that'll do me fine for now. – bruce Feb 06 '18 at 13:35

1 Answers1

1

Just to make sure this question has an answer, the problem was that the question asker was running port-forward from the Google Cloud Shell rather than from his local machine. This meant that the service was not accessible to his local machine's web browser (because the Cloud Shell is running on a VM in Google's datacenters).

The ideal solution is to run the kubectl port-forward command from his own computer.

Or, barring that, to expose the cockroachdb pod externally using the kubectl expose pod cockroachdb-0 --port=8080 --type=LoadBalancer as suggested in the comments.

Alex Robinson
  • 12,633
  • 2
  • 38
  • 55