How to Use kubectl Directly on Your Raspberry Pi k3s Node

You’ve set up a k3s Kubernetes cluster on your Raspberry Pi and deployed an application. While managing it remotely with kubectl from your main computer is great, sometimes you need to quickly check pod status or logs directly on the Pi itself.

You mi…


This content originally appeared on DEV Community and was authored by Shankar

You've set up a k3s Kubernetes cluster on your Raspberry Pi and deployed an application. While managing it remotely with kubectl from your main computer is great, sometimes you need to quickly check pod status or logs directly on the Pi itself.

You might notice that just typing kubectl get pods on the Pi gives you a connection error. That's because the standard kubectl command doesn't automatically know where to find the k3s cluster configuration or have the right permissions.

Luckily, k3s provides a handy wrapper command! Here's how to use it:

Steps

  1. SSH into your Raspberry Pi:
    Connect to your Pi using its hostname or IP address.

    ssh <your_pi_user>@<your_pi_hostname_or_ip>
    # Example: ssh pi-admin@k3s-node.local
    
  2. Run the k3s kubectl Command:
    Prefix your usual kubectl commands with sudo k3s kubectl. This special command automatically uses the correct admin configuration (/etc/rancher/k3s/k3s.yaml) and runs with the necessary permissions.

    To check your running pods:

    # On the Pi
    sudo k3s kubectl get pods -A # -A shows pods in all namespaces
    

    Or, if you know the namespace (e.g., default):

    # On the Pi
    sudo k3s kubectl get pods -n default
    
  3. Check Pod Logs (Optional but useful):
    First, get the full name of the pod you're interested in from the get pods command above (it will look something like my-app-deployment-xxxxxxxxxx-xxxxx). Then, view its logs:

    # On the Pi - Replace <your-pod-name> and <namespace>
    sudo k3s kubectl logs -f <your-pod-name> -n <namespace>
    # Example: sudo k3s kubectl logs -f my-app-deployment-7f8c9d4b4f-g2hjl -n default
    

    The -f flag follows the logs in real-time, showing you the latest output from your application's container directly in the Pi's terminal.

That's all there is to it! Using sudo k3s kubectl is the straightforward way to interact with your k3s cluster directly on the node it's running on.


This content originally appeared on DEV Community and was authored by Shankar


Print Share Comment Cite Upload Translate Updates
APA

Shankar | Sciencx (2025-10-30T11:02:49+00:00) How to Use kubectl Directly on Your Raspberry Pi k3s Node. Retrieved from https://www.scien.cx/2025/10/30/how-to-use-kubectl-directly-on-your-raspberry-pi-k3s-node/

MLA
" » How to Use kubectl Directly on Your Raspberry Pi k3s Node." Shankar | Sciencx - Thursday October 30, 2025, https://www.scien.cx/2025/10/30/how-to-use-kubectl-directly-on-your-raspberry-pi-k3s-node/
HARVARD
Shankar | Sciencx Thursday October 30, 2025 » How to Use kubectl Directly on Your Raspberry Pi k3s Node., viewed ,<https://www.scien.cx/2025/10/30/how-to-use-kubectl-directly-on-your-raspberry-pi-k3s-node/>
VANCOUVER
Shankar | Sciencx - » How to Use kubectl Directly on Your Raspberry Pi k3s Node. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/30/how-to-use-kubectl-directly-on-your-raspberry-pi-k3s-node/
CHICAGO
" » How to Use kubectl Directly on Your Raspberry Pi k3s Node." Shankar | Sciencx - Accessed . https://www.scien.cx/2025/10/30/how-to-use-kubectl-directly-on-your-raspberry-pi-k3s-node/
IEEE
" » How to Use kubectl Directly on Your Raspberry Pi k3s Node." Shankar | Sciencx [Online]. Available: https://www.scien.cx/2025/10/30/how-to-use-kubectl-directly-on-your-raspberry-pi-k3s-node/. [Accessed: ]
rf:citation
» How to Use kubectl Directly on Your Raspberry Pi k3s Node | Shankar | Sciencx | https://www.scien.cx/2025/10/30/how-to-use-kubectl-directly-on-your-raspberry-pi-k3s-node/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.