มาทำ Kubernetes แบบ Single Cluster เพื่อ Develop กันดีกว่า

Docker ❤ K8s
vm spec
~$ sudo apt-get update \
&& sudo apt-get upgrade -y \
&& sudo apt-get dist-upgrade -y \
&& sudo apt-get clean \
&& sudo apt-get autoremove -y
~$ sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common docker.io
~$ sudo systemctl enable docker.service
~$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
~$ sudo  nano /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
~$ sudo apt-get update
~$ sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni
~$ sudo swapoff -a
~$ sudo nano /etc/fstab
~$ sudo kubeadm init \
--apiserver-advertise-address=<IP เครื่อง> \
--pod-network-cidr=10.244.0.0/16
~$ sudo kubeadm init \
--apiserver-advertise-address=192.168.195.138 \
--pod-network-cidr=10.244.0.0/16
K8s join token
~$ mkdir -p $HOME/.kube &&\
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config &&\
sudo chown $(id -u):$(id -g) $HOME/.kube/config
~$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
~$ kubectl get pods -n kube-system
k8s service status
~$ kubectl taint nodes --all node-role.kubernetes.io/master-
~$ kubectl create -f https://raw.githubusercontent.com/VatthanachaiW/kubernete-config/master/kubernetes-dashboard.yaml
k8s dashboard create result
~$ kubectl apply -f https://raw.githubusercontent.com/VatthanachaiW/kubernete-config/master/kube-dashboard-config.yaml
k8s dashboard config apply result
~$ kubectl create -f https://raw.githubusercontent.com/VatthanachaiW/kubernete-config/master/kube-heapster-addon.yaml
k8s heapster add-on create result
~$ kubectl create -f https://raw.githubusercontent.com/VatthanachaiW/kubernete-config/master/influxdb.yaml
k8s influxdb create result
~$ kubectl create -f https://raw.githubusercontent.com/VatthanachaiW/kubernete-config/master/heapster.yaml
k8s heapster cluster create result
k8s service list
~$ kubectl proxy
~$ sudo kubectl proxy --address="<IP เครื่อง>" -p <port> --accept-hosts='^*$' &
~$ sudo kubectl proxy --address="192.168.195.138" -p 443 --accept-hosts='^*$' &
~$ sudo kubectl proxy --address="0.0.0.0" -p 443 --accept-hosts='^*$' &
http://192.168.195.138:443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
Kubernetes Dashboard Authentication
k8s dash board
~$ sudo kubeadm reset
~$ sudo kill $(sudo lsof -t -i:<port>)
sudo kill $(sudo lsof -t -i:443)

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store