One Liner: ULTIMATE Kubernetes Install! K3s! Ubuntu, CentOS, Debian, RHEL. Best k8s, minikube, okd, Openshift Alternative.

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 | 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 containerd runc -y
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
curl -fsSL |  apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
apt-get update -y
apt-get install docker-ce docker-ce-cli -y
docker run hello-world
curl -sfL | 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

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${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml

echo 'apiVersion: v1
kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard' > dashboard.admin-user.yml

echo 'apiVersion:
kind: ClusterRoleBinding
  name: admin-user
  kind: ClusterRole
  name: cluster-admin
- 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

Leave a Reply

Your email address will not be published. Required fields are marked *