# kURL: Setting kubectl config correctly inside a kURL control plane node

**URL:** <https://community.replicated.com/t/kurl-setting-kubectl-config-correctly-inside-a-kurl-control-plane-node/1307>\
**Category:** How do I?\
**Tags:** kurl, kubectl\
**Created:** [October 5, 2023, 12:50pm UTC](https://community.replicated.com/t/kurl-setting-kubectl-config-correctly-inside-a-kurl-control-plane-node/1307 "2023-10-05T12:50:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evans\_Mungai](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/evans_mungai/32/546_2.png) [@Evans\_Mungai](https://community.replicated.com/u/Evans_Mungai)\
**Post date:** [October 5, 2023, 12:50pm UTC](https://community.replicated.com/t/kurl-setting-kubectl-config-correctly-inside-a-kurl-control-plane-node/1307/1 "2023-10-05T12:50:45Z")

</div>

When in a kURL control plane node, at times when you run `kubectl` commands such as `kubectl get pods`, you might get errors that indicate that you either cannot connect to the cluster (`The connection to the server localhost:8080 was refused - did you specify the right host or port?`) or are not authenticated. This might be because you do not have your kubectl config setup correctly. To set it up correctly, please do the following.

NOTE: This commands assume a you are on a \*nix environment, which is all that kURL currently supports

- Ensure you can successfully run `kubectl` commands using `/etc/kubernetes/admin.conf` config

```sh
sudo kubectl --kubeconfig /etc/kubernetes/admin.conf get pods

```

- Copy the config to your `~/.kube` directory

```sh
mkdir -p .kube/ && sudo cp /etc/kubernetes/admin.conf .kube/config && sudo chown $USER:$USER .kube/config

```

- Clear any `KUBECONFIG` environment variables that may have been set prior

```sh
unset KUBECONFIG

```

- (Optional) for good measure, log out and log back into the node
