Answers: <p>This is another error message relate to your kubectl config. In this case you likely have an environmental variable <code>KUBECONFIG</code> pointing to a location that doesn't exist.</p>
  <p>First confirm this is set to the same location above that didn't exist</p>
  <pre class="lang-shell prettyprint-override"><code>echo $KUBECONFIG
  </code></pre>
  <p>If it's already set, simply regenerate a kubeconfig for k3s with</p>
  <pre class="lang-shell prettyprint-override"><code>mkdir ~/.kube 2&gt; /dev/null
  sudo k3s kubectl config view --raw &gt; &quot;$KUBECONFIG&quot;
  chmod 600 &quot;$KUBECONFIG&quot;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2023-07-31T00:48:55.037Z
Answers: 2023-07-31T00:48:55.037Z
Answers: Evan Carroll
Body: <p>When I run <code>k3s kubectl version</code></p>
  <pre><code>$ k3s kubectl version
  W0730 19:46:32.066086   17273 loader.go:222] Config not found: /home/ecarroll/.kube/config
  [...]
  The connection to the server localhost:8080 was refused - did you specify the right host or port?
  </code></pre>
  <p>How can I fix this problem?</p>
  
Tags: <kubectl><k3s>
Title: Config not found in /home/$USER/.kube/config
UserDisplayName: Evan Carroll
ThreadText: # Config not found in /home/$USER/.kube/config
  
  (Asked by: username_0 on 2023-07-31)
  
  When I run `k3s kubectl version`
  
  ```
  $ k3s kubectl version
  W0730 19:46:32.066086   17273 loader.go:222] Config not found: /home/ecarroll/.kube/config
  [...]
  The connection to the server localhost:8080 was refused - did you specify the right host or port?
  
  ```
  
  How can I fix this problem?
  
  **Tags:** kubectl, k3s
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-07-31. Score: 0 | Accepted answer
  
  This is another error message relate to your kubectl config. In this case you likely have an environmental variable `KUBECONFIG` pointing to a location that doesn't exist.
  
  First confirm this is set to the same location above that didn't exist
  
  ```shell
  echo $KUBECONFIG
  
  ```
  
  If it's already set, simply regenerate a kubeconfig for k3s with
  
  ```shell
  mkdir ~/.kube 2> /dev/null
  sudo k3s kubectl config view --raw > "$KUBECONFIG"
  chmod 600 "$KUBECONFIG"
  
  ```
  
  
  ---
  
  