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

Run Arango Shell (Arangosh) on a Kubernetes pod #734

Closed
thearghyadutta opened this issue Jun 8, 2021 · 4 comments
Closed

Run Arango Shell (Arangosh) on a Kubernetes pod #734

thearghyadutta opened this issue Jun 8, 2021 · 4 comments

Comments

@thearghyadutta
Copy link

I have set up an Arango instance on Kubernetes nodes, which were installed on a VM, as mentioned in the ArangoDB docs ArangoDB on Kubernetes. Keep in mind, I skipped the ArangoLocalStorage and ArangoDeploymentReplication step. I can see 3 pods each of agent, coordinators and dbservers in get pods.

The arango-cluster-ea service, however, shows the external IP as pending. I can use the master node's IP address and the service port to access the Web UI, connect to the DB and make changes. But I am not able to access either the Arango shell, nor am I able to use my Python code to connect to the DB. I am using the Master Node IP and the service port shown in arango-cluster-ea in services to try to make the Python code connect to DB. Similarly, for arangosh, I am trying the code kubectl exec -it _arango-cluster-crdn-pod-name_ -- arangosh --service.endpoint tcp://masternodeIP:8529 . I assume I have to connect to one of the coordinator pods, since they are the ones handling the client requests.

In case of Python, since the Connection class call is in a try block, it goes to except block. In case of Arangosh, it opens the Arango shell with the error "Cannot connect to tcp://masternodeIP:port", thus not connecting to the DB.

Any leads about this would be appreciated.

@ajanikow
Copy link
Collaborator

ajanikow commented Jun 8, 2021

Hello!

Can you share the ArangoDeployment YAML? To determine if SSL is enabled, if yes then you should connect over SSL.

Also, if you try to connect to the service from the cluster itself you should use service without -ea. It is recommended because sometimes you have limitations in routing/firewall which does not allow you to connect to the NodePort exposed ports from pods inside.

This service is ClusterIP type and has the same name as your ArangoDeployment CR.

Best Regards,
Adam.

@thearghyadutta
Copy link
Author

Hi
I am using the 1.1.8 manifest of arango-deployment [https://raw.githubusercontent.com/arangodb/kube-arangodb/1.1.8/manifests/arango-deployment.yaml]

Here's the cluster YAML file contents, if that's helpful.

`

apiVersion: "database.arangodb.com/v1alpha"
kind: "ArangoDeployment"
metadata:
name: "arango-cluster"
spec:
mode: Cluster
image: arangodb/arangodb:3.7.6
agents:
storageClassName: my-local-storage
resources:
requests:
storage: 2Gi
dbservers:
storageClassName: my-local-storage
resources:
requests:
storage: 5Gi
externalAccess:
type: NodePort
#type: LoadBalancer
nodePort: 31200

`

Thanks

@ajanikow
Copy link
Collaborator

Hello!

Your setup use TLS, for web browser there can be redirect, but for ArangoSH you need to use tls instead of TCP. If it wont help try to use service 'arango-cluster' to connect.

Best Regards,
Adam.

@thearghyadutta
Copy link
Author

Here's how my issue got resolved:

  1. To connect to arangosh, what worked for me was to use ssl before using the localhost:8529 ip-port combination in the server.endpoint. Here's the command that worked:
    kubectl exec -it _arango_cluster_crdn_podname_ -- arangosh --server.endpoint ssl://localhost:8529

  2. For web browser, since my external access was based on NodePort type, I put in the master node's IP and the 30000-level port number that was generated (in my case, it was 31200).

  3. For Python, in case of PyArango's Connection class, it worked when I used the arango-cluster-ea service. I put in the following line in the connection call:
    conn = Connection(arangoURL='https://arango-cluster-ea:8529', verify= False, username = 'root', password = 'XXXXX')
    The verify=False flag is important to ignore the SSL validity, else it will throw an error again.

Hopefully this solves somebody else's issue, if they face the similar issue.

Closing this.

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

2 participants