Forget minikube, k8s, docker swarm, okd, Openshift or any other bloated mess of amateur shell scripts.
This is the one. Install Docker on ANY of the above Operating Systems and then run:
# run this and you're done! curl -sfL https://get.k3s.io | sh -
kubectl get node kubectl get get all --all-namespaces
TIP: instead of writing kubectl all the time, it’s much more efficient to put an alias for this command:
echo 'alias ks=kubectl' >> ~/.bashrc echo 'alias k=kubectl' >> ~/.bashrc source ~/.bashrc
Now you can type ks or just k to run kubectl commands. I like ks because it sits right under the fingers, ready for action.
If you haven’t got Docker, run this first:
Install Docker CE on Ubuntu
apt-get remove docker docker-engine docker.io containerd runc -y apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - apt-key fingerprint 0EBFCD88 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-get update -y apt-get install docker-ce docker-ce-cli containerd.io -y docker run hello-world curl -sfL https://get.k3s.io | sh -
And you’re done!
Install a Local Docker Registry On your Kubernetes VM
Put the docker file in your current directory
docker run -d -p 5000:5000 --restart=always --name registry registry:2 docker build --no-cache -t IMAGENAME . docker tag IMAGENAME localhost:5000/IMAGENAME docker push localhost:5000/IMAGENAME
Now you can pull direct from that image
docker run localhost:5000/IMAGENAME
Install the Kubernetes Dashboard on K3s
GITHUB_URL=https://github.com/kubernetes/dashboard/releases VERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S ${GITHUB_URL}/latest -o /dev/null | sed -e 's|.*/||') sudo k3s kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml echo 'apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard' > dashboard.admin-user.yml echo 'apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-user roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard' > dashboard.admin-user-role.yml k3s kubectl create -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml k3s kubectl -n kubernetes-dashboard describe secret admin-user-token | grep ^token k3s kubectl proxy