Access Rok from Within Cluster¶
This guide contains instructions to access Rok in your Arrikto EKF deployment from a Pod in the same cluster.
Overview
What You’ll Need¶
- An existing Kubernetes cluster.
- An Arrikto EKF or MiniKF deployment with the default Kale Docker image.
Procedure¶
Choose one of the following options, depending on your desired environment.
To access Rok using the UI, follow the instructions in the
Access Rok from External Client section of the docs.
Create a notebook server and enable the configuration that allows access to Rok.
Use the
rok
CLI to interact with the Rok API server:Note
When in-cluster, the client automatically sets the requests’ namespace to the Pod’s namespace
jovyan@mynotebook-0:~$ rok account-show Account Information Account Name kubeflow-user Account UUID 1790af25-41c2-4e37-92cb-a2a3ee11fb9a Bucket Count 5 Version Bytes Used 482GiB Version Count 190 Bytes Used 100GiB Object Count 16 Created At 2021-10-05T16:11:56.764930+00:00jovyan@mynotebook-0:~$ rok bucket-list Name Objects Object Bytes Versions Version Bytes Type Paused auto-backup 2 20GiB 12 40GiB local False
Create a notebook server and enable the configuration that allows access to Rok.
Create a new Python file and name it
access-rok.py
:jovyan@mynotebook-0:~$ touch access-rok.pyCopy and paste the following code inside
access-rok.py
:access-rok-incluster.py1 # Copyright © 2022 Arrikto Inc. All Rights Reserved. 2 3 """Access the Rok API.""" 4-10 4 5 from rok_gw_client import RokClient 6 7 # Initialize the Rok client 8 client = RokClient() 9 10 # Access the Rok API 11 account_info, buckets = client.bucket_list() 12 print("Successfully retrieved %d Rok bucket(s) in namespace '%s'" 13 % (len(buckets), client.account)) Alternatively, download the Python file above in your execution environment.
Run the script using Python 3:
jovyan@mynotebook-0:~$ python3 access-rok.py Successfully retrieved 3 Rok bucket(s) in namespace 'kubeflow-user'