Install standalone Kubernetes (minikube) on Fedora 26
|
September 8, 2017
|
Development,
Linux,
Kubernetes
Just another instructional page on how to install Kubernetes and Docker on your laptop. I needed something I could just bring up when I needed to try something outs.
Another link for good instructions: Fedora Magazine Minikube Kubernetes
Requirements:
- Fedora 26 Workstation
- KVM Hypervisor - groupinstall Virtualization
- docker-ce
- kubectl
- minikube
- docker-machine-kvm
sudo usermod -a -G libvirt,docker <username>Do a 'id <username>' to be sure
id <username> uid=1000(username) gid=1000(groupname) groups=18(group18),496(docker),984(libvirt)The numbers don't matter, just be sure the libvirt and docker group is there Make sure you can run docker, minikube and kubectl without using sudo If you have to use sudo, either you are not in the right group or permissions on the executable is not correct. 3) Start docker service
systemctl start dockerYou can enable it so it comes up after reboots
systemctl enable dockerYou should be able to do docker commands without sudo.
docker images docker container lsif you get and error like "Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.31/images/json: dial unix /var/run/docker.sock: connect: permission denied" You are not in the docker group 4) Start minikube and ensure a virtual machine is in virt-manager
minikube start --vm-driver=kvm --insecure-registry libraryThe vm-driver tells minikube to use kvm insecure-registry
- I came across several issues with minikube and trying to get self made docker images to run.
- Kubenetes would not run the self made images. It looking for library/imagename. It could not find it so it could not load it. This creates a registry called library.
eval $(minikube docker-env)5) Setup kubectl to use minikube
kubectl config use-context minikube6) Create a docker image It is easier to create a Dockerfile and then build it.
docker build -t imagename:v# .When you create an image use versions. Seems there are issues with local images and 'latest'. Use v1 or some sort of versioning in the name 7) Start the minikube dashboard
minikube dashboard8) Run your docker image
kubectl run stl --image=imagename:v# --port=#### --image-pull-policy=IfNotPresentI add the port number the image will run on in the container The image pull policy is needed so it looks at the local registry. If you don't use this, you might get and error about trying to find your image. Check out the dashboard and see if it is running. Log into the pod and check it out
kubectl exec -it <pod name> bash
