Can I access k3s using just kubectl (no sudo and no k3s command)
Can I access k3s using just kubectl (no sudo and no k3s command)
Reddit · reddit.com [1]
Right after installing k3s you are going to need to use sudo to use any kubectl command. The reason for this is that the default config is owned by root. To get around this you will need to make your own config and set the KUBECONFIG environment variable
To do this I used sudo one last time to copy the k3s.yaml file into my own directory and take ownership of it.
sudo cp /etc/rancher/k3s/k3s.yaml /home/waylon/.config/kube
sudo chown -R waylon:waylon ~/.config/kube
export KUBECONFIG=~/.config/kube/k3s.yaml
Note
This post is a thought [2]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://www.reddit.com/r/kubernetes/comments/cojjf5/can_i_access_k3s_using_just_kubectl_no_sudo_and/
[2]: /thoughts/
Posts tagged: homelab
All posts with the tag "homelab"
40 posts
latest post 2026-04-08
Publishing rhythm
Quick-Start Guide | K3s
This guide will help you quickly launch a cluster with default options. Make sure your nodes meet the requirements before proceeding.
docs.k3s.io [1]
I recently spun up k3s in my homelab [2]. I’m trying to offload some work off of my free tier fly.io app in order to keep it free tier without crashing.
# install and start k3s
curl -sfL https://get.k3s.io | sh -
# check to see if your nodes are started
sudo kubectl get nodes
My main hiccup so far was the machine I am running on runs zfs on root, and it would not start the master node. Rather than figuring out how to make zfs play nice I just pointed k3s to a drive that is not zfs.
# manuallly
sudo k3s server -d /mnt/vault/.rancher/k3s
# without editing systemd service
sudo ln -s /mnt/vault/.rancher/k3s /var/lib/rancher/k3s
Note
This post is a thought [3]. It’s a short note that I make
about someone else’s content online #thoughts
References:
[1]: https://docs.k3s.io/quick-start
[2]: /homelab/
[3]: /thoughts/
In my adventure to put more homelab [1] in docker, I moved our modded
minecraft setup to docker.
Getting Mods # [2]
So far I have found all of our mods from curse
forge [3]. modpacks make
getting multiple mods working together much easier, someone else has
already vetted a pack of often times 100+ mods that all play well
together. I have yet to get these working in docker, I will, but for
not I just have individual mods.
download file # [4]
under the hood docker is using wget to get the mod. The link you click
on from curseforge will block wget. What I do is pop open the devtools
(f12 in chrome), click on the network tab, click the download link on
the web page, and watch the real link show up.
[5]
Docker-compose # [6]
I am using docker compose, it makes the command much easier to start,
and all the things needed stored in a file. I am not using compose to
run multiple things, just for the simple start command.
Create a directory for your server and add the following to a
docker-compose.yml file.
version: "3.8"
services:
mc:
container_name: walkercraft
image: itzg/minecraft-server
ports:
- 25565:25565
environment:
EULA: "TRUE"
TYPE: "FORGE"
VERSION: 1.16.5
M...
I’ve ran a Minecraft server at home since December 2017 for me and my
son to play on. We start a brand new one somewhere between every day
and every week. The older he gets the longer the server lasts.
In all these years, I’ve been popping open the command line and running
the server manually, and even inside of Digital Ocean occasionally to
play a more public server with a friend.
My buddy Nic has been sharing me some of his homelab [1] setup, and it’s
really got me to thinking about what I can run at home, and Dockerizing
all the things. Today I found a really sweet github repo that had a
minecraft server running in docker with a pretty incredible setup.
I ended up running the first thing in the Readme that included a volume
mount. If you are going to run this container, I HIGHLY reccomend that
you make sure that you have your world volume mounted, otherwise it will
die with your docker container.
Docker Compose # [2]
With the following stored as my docker-compose.yml in a brand new and
otherwise empty directory I was ready to start the server for the night.
version: "3"
services:
mc:
container_name: walkercraft
image: itzg/minecraft-server
ports:
- 25565:25565
en...