github.com/pachyderm/pachyderm@v1.13.4/doc/docs/1.9.x/deploy-manage/deploy/import-kubernetes-context.md (about)

     1  # Import a Kubernetes Context
     2  
     3  **Note:** The steps in this section apply to your configuration only
     4  if you deployed Pachyderm from a manifest created by the `pachctl deploy`
     5  command with the `--dry-run` flag. If you did not use the `--dry-run` flag,
     6  skip this section.
     7  
     8  When you run the `pachctl deploy` command with `--dry-run` flag, instead of
     9  immediately deploying a cluster, the command creates a Kubernetes
    10  deployment manifest that you can further edit and later use to deploy a
    11  Pachyderm cluster.
    12  
    13  You can use that manifest with a standard `kubectl apply` command to deploy
    14  Pachyderm. For example, if you have created a manifest called
    15  `test-manifest.yaml`, you can deploy a Pachyderm cluster by running the
    16  following command:
    17  
    18  ```shell
    19  kubectl apply -f test-manifest.yaml
    20  ```
    21  
    22  Typically, when you run `pachctl deploy`,
    23  Pachyderm creates a new Pachyderm context with the information from
    24  the current
    25  [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context)
    26  embedded into it.
    27  
    28  When you use the `--dry-run` flag, the Pachyderm context is not created.
    29  Therefore, if you deploy a Pachyderm cluster from a manifest that you have
    30  created earlier, you need to manually create a new Pachyderm context with
    31  the embedded current Kubernetes context and activate that context.
    32  
    33  To import a Kubernetes context, complete the following steps:
    34  
    35  1. Deploy a Pachyderm cluster from the Kubernetes manifest that you have
    36     created when you ran the `pachctl deploy` command with the `--dry-run`
    37     flag:
    38  
    39     ```shell
    40     $ kubectl apply -f <manifest.yaml>
    41     clusterrole.rbac.authorization.k8s.io/pachyderm configured
    42     clusterrolebinding.rbac.authorization.k8s.io/pachyderm configured
    43     deployment.apps/etcd configured
    44     service/etcd configured
    45     service/pachd configured
    46     deployment.apps/pachd configured
    47     service/dash configured
    48     deployment.apps/dash configured
    49     secret/pachyderm-storage-secret configured
    50     ```
    51  
    52  1. Verify that the cluster was successfully deployed:
    53  
    54     ```shell
    55     $ kubectl get pods
    56     NAME                     READY   STATUS    RESTARTS   AGE
    57     dash-64c868cc8b-j79d6    2/2     Running   0          20h
    58     etcd-6865455568-tm5tf    1/1     Running   0          20h
    59     pachd-6464d985c7-dqgzg   1/1     Running   0          70s
    60     ```
    61  
    62     You must see all the `dash`, `etcd`, and `pachd` pods running.
    63  
    64  1. Create a new Pachyderm context with the embedded Kubernetes context:
    65  
    66     ```shell
    67     $ pachctl config set context <new-pachyderm-context> -k `kubectl config current-context`
    68     ```
    69  
    70  1. Verify that the context was successfully created and view the context parameters:
    71  
    72     **Example:**
    73  
    74     ```shell
    75     $ pachctl config get context test-context
    76     {
    77       "source": "IMPORTED",
    78       "cluster_name": "minikube",
    79       "auth_info": "minikube",
    80       "namespace": "default"
    81     }
    82     ```
    83  
    84  1. Activate the new Pachyderm context:
    85  
    86     ```shell
    87     $ pachctl config set active-context <new-pachyderm-context>
    88     ```
    89  
    90  1. Verify that the new context has been activated:
    91  
    92     ```shell
    93     $ pachctl config get active-context
    94     ```