Access Rok from Within Cluster

This guide contains instructions to access Rok in your Arrikto EKF deployment from a Pod in the same cluster.

What You’ll Need

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.
  1. Create a notebook server and enable the configuration that allows access to Rok.

    ../../../_images/allow-rok-access.png
  2. 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:00
    jovyan@mynotebook-0:~$ rok bucket-list Name Objects Object Bytes Versions Version Bytes Type Paused auto-backup 2 20GiB 12 40GiB local False
  1. Create a notebook server and enable the configuration that allows access to Rok.

    ../../../_images/allow-rok-access.png
  2. Create a new Python file and name it access-rok.py:

    jovyan@mynotebook-0:~$ touch access-rok.py
  3. Copy and paste the following code inside access-rok.py:

    access-rok-incluster.py
    1# Copyright © 2022 Arrikto Inc. All Rights Reserved.
    2
    3"""Access the Rok API."""
    4-10
    4
    5from rok_gw_client import RokClient
    6
    7# Initialize the Rok client
    8client = RokClient()
    9
    10# Access the Rok API
    11account_info, buckets = client.bucket_list()
    12print("Successfully retrieved %d Rok bucket(s) in namespace '%s'"
    13 % (len(buckets), client.account))

    Alternatively, download the Python file above in your execution environment.

  4. Run the script using Python 3:

    jovyan@mynotebook-0:~$ python3 access-rok.py Successfully retrieved 3 Rok bucket(s) in namespace 'kubeflow-user'

Summary

You have successfully accessed Rok from a Pod in the same Kubernetes cluster.

What’s Next

Check out the rest of the user guides regarding Rok.