Giter Site home page Giter Site logo

bare-metal-kubernetes's Introduction

Ondrej Sika (sika.io) | [email protected]

Bare Metal Kubernetes

Ondrej Sika <[email protected]>
https://github.com/ondrejsika/bare-metal-kubernetes

About Course

Kubernetes Training

Related Repository

Any Questions?

Write me mail to [email protected]


Install Docker

curl -fsSL https://ins.oxs.cz/docker.sh | sudo sh

Install Kubernetes (kubeadm, kubectl)

curl -fsSL https://ins.oxs.cz/kubernetes.sh | sudo sh

Install NFS client (for NFS Persistant Volume Claims)

sudo apt install nfs-common

Create a Master

Kubernetes doesn't run if you have swap on. You can disable it using:

swapoff -a

Now you can setup master

kubeadm init --pod-network-cidr=10.244.0.0/16

Configure kubect

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Join nodes

You can also disable swap, if it's on:

swapoff -a
kubeadm join <ip>:6443 --token <token> --discovery-token-ca-cert-hash <ca-hash>

Master only

If you want run cluster with just one server (master only), you have to allow to run containers on master, which is not recommended.

kubectl taint nodes --all node-role.kubernetes.io/master-

Install Flannel network

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

or

kubectl apply -f kube-flannel.yml

Check Nodes

kubectl get nodes

Install Dashboard

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

or

kubectl apply -f kubernetes-dashboard.yaml

Add Dashboard User

kubectl apply -f https://raw.githubusercontent.com/ondrejsika/kubernetes-install-bare-metal/master/dashboard-user.yml
kubectl apply -f dashboard-user.yml

Get Dashboard Token

kubectl -n kube-system describe serviceaccounts admin-user
kubectl -n kube-system describe secret <admin-user-token>

Or in one line

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t'

Run kubectl proxy

kubectl proxy

Open http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

Create Traefik LoadBalancer (for Ingress)

I've prepared Ingress Controllet configuration, you can apply it by:

kubectl apply -f https://raw.githubusercontent.com/ondrejsika/kubernetes-ingress-traefik/master/ingress-traefik.yml

or browse in own repository ondrejsika/kubernetes-ingress-traefik

Install Helm Client

Docs https://github.com/helm/helm/blob/master/docs/install.md

Or oneliner for Linux:

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash

Or on Windows:

choco install kubernetes-helm

Install NFS Client Provisioner (using Helm)

helm install nfs-client-provisioner stable/nfs-client-provisioner --set nfs.server=<nfs-server> --set nfs.path=<exported-path>

For example:

helm install nfs-client-provisioner stable/nfs-client-provisioner --set nfs.server=nfs.sikademo.com --set nfs.path=/nfs

Set nfs-client as Default Storage Class

kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

bare-metal-kubernetes's People

Contributors

ondrejsika avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bare-metal-kubernetes's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.