Manage Cluster Access

Learn how to manage Kubernetes cluster access using Pachyderm Contexts.

December 5, 2022

Pachyderm contexts enable you to store configuration parameters for multiple Pachyderm clusters in a single configuration file saved at ~/.pachyderm/config.json. This file stores the information about all Pachyderm clusters that you have deployed from your machine locally or on a remote server.

For example, if you have a cluster that is deployed locally in minikube and another one deployed on Amazon EKS, configurations for these clusters are stored in that config.json file. By default, all local cluster configurations have the local prefix. If you have multiple local clusters, Pachyderm adds a consecutive number to the local prefix of each cluster.

The following text is an example of a Pachyderm config.json file:

{
   "user_id": "b4fe4317-be21-4836-824f-6661c68b8fba",
   "v2": {
     "active_context": "local-1",
     "contexts": {
       "default": {},
       "local": {},
       "local-1": {},
     },
     "metrics": true
   }
}

View the Active Context #

When you have multiple Pachyderm clusters, you can switch between them by setting the current context. The active context is the cluster that you interact with when you run pachctl commands.

To view active context, type:

  • View the active context:

    pachctl config get active-context

    System response:

    local-1
  • List all contexts and view the current context:

    pachctl config list context

    System response:

      ACTIVE  NAME
              default
              local
      *       local-1

    The active context is marked with an asterisk.

Change the Active Context #

To change the active context, type pachctl config set active-context <name>.

Also, you can set the PACH_CONTEXT environmental variable that overrides the active context.

Example:

export PACH_CONTEXT=local1

Create a New Context #

When you deploy a new Pachyderm cluster, a new context that points to the new cluster is created automatically.

In addition, you can create a new context by providing your parameters through the standard input stream (stdin) in your terminal. Specify the parameters as a comma-separated list enclosed in curly brackets.

ℹ️

By default, the pachd port is 30650.

To create a new context with specific parameters, complete the following steps:

  1. Create a new Pachyderm context with a specific pachd IP address and a client certificate:

    echo '{"pachd_address":"10.10.10.130:650", "server_cas":"insert your base 64 encoded key.pem"}' | pachctl config set context new-local

    System response:

    Reading from stdin
  2. Verify your configuration by running the following command:

    pachctl config get context new-local
    {
      "pachd_address": "10.10.10.130:650",
      "server_cas": "insert your base 64 encoded key.pem"
    }

Update an Existing Context #

You can update an existing context with new parameters, such as a Pachyderm IP address, certificate authority (CA), and others. For the list of parameters, see Pachyderm Config Specification.

To update the Active Context, run the following commands:

  1. Update the context with a new pachd address:

    pachctl config update context local-1 --pachd-address 10.10.10.131

    The pachctl config update command supports the --pachd-address flag only.

  2. Verify that the context has been updated:

    pachctl config get context local-1

    System response:

    {
      "pachd_address": "10.10.10.131"
    }
  3. Alternatively, you can update multiple properties by using an echo script:

    echo '{"pachd_address":"10.10.10.132", "server_cas":"insert your base 64 encoded key.pem"}' | pachctl config set context local-1 --overwrite

    System response:

    Reading from stdin.
  4. Verify that the changes were applied:

    pachctl config get context local-1

    System response:

    {
      "pachd_address": "10.10.10.132",
      "server_cas": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVEakNDQXZhZ0F3SUJBZ0lERDkyc01BMEdDU3FHU0liM0RRRUJDd1VBTUVVeEN6QUpCZ05WQkFZVEFrUkYKTVJVd0V3WURWUVFLREF4RUxWUnlkWE4wSUVkdFlrZ3hIekFkQmdOVkJBTU1Ga1F0VkZKVlUxUWdVbTl2ZENCRApRU0F6SURJd01UTXdIaGNOTVRNd09USXdNRGd5TlRVeFdoY05Namd3T1RJd01EZ3lOVFV4V2pCRk1Rc3dDUVlEClZRUUdFd0pFUlRFVk1CTUdBMVVFQ2d3TVJDMVVjblZ6ZENCSGJXSklNUjh3SFFZRFZRUUREQlpFTFZSU1ZWTlUKSUZKdmIzUWdRMEVnTXlBeU1ERXpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQQp4SHRDa29JZjdPMVVtSTRTd01vSjM1TnVPcE5jRytRUWQ1NU9hWWhzOXVGcDh2YWJvbUd4dlFjZ2RKaGw4WXdtCkNNMm9OY3FBTnRGamJlaEVlb0xEYkY3ZXUrZzIwc1JvTm95Zk1yMkVJdURjd3U0UVJqbHRyNU01cm9mbXc3d0oKeVN4cloxdlptM1oxVEF2Z3U4WFh2RDU1OGwrKzBaQlgrYTcyWmw4eHY5TnRqNmU2U3ZNalpidTM3Nk1sMXdycQpXTGJ2aVByNmViS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