当前位置:网站首页>Kubernetes cluster deployment
Kubernetes cluster deployment
2022-07-06 16:20:00 【Cute Chu】
Image download 、 Domain name resolution 、 Time synchronization please click Alibaba cloud open source image station
One 、 Environmental requirements
System version :CentOS7.x edition
hardware configuration : Memory 2GB above cpu2 Supranuclear Hard disk is larger than 30G
Cluster network configuration : The intranet of all servers in the cluster must be interconnected , And you need to access the Internet to pull the image
Ban swap Partition
Two 、k8s Basic environment operation :
1、 Turn off firewall :
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
2、 close selinux:
[[email protected] ~]# sed -i 's/enforcing/disabled/' /etc/selinux/config
[[email protected] ~]# getenforce
3、 close swap Partition :
Temporarily Closed :
[[email protected] ~]# swapoff -a
Permanent ban : Comment out /etc/fstab In the document swap That's ok
4、 Conduct hosts File editing :
192.168.8.146 k8s-master
192.168.8.141 k8s-node1
192.168.8.129 k8s-node2
5、 To be bridged IPv4 Flow to iptables Chain
[[email protected] ~]# cat > /etc/sysctl.d/k8s.conf << EOF
> net.bridge.bridge-nf-call-ip6tables = 1
> net.bridge.bridge-nf-call-iptables = 1
> EOF
[[email protected] ~]# sysctl --system
6、 Turn on IP Forward capability
[[email protected] ~]# echo "1" > /proc/sys/net/ipv4/ip_forward
3、 ... and 、 install docker( All three machines operate )
1、 Uninstall the old version docker
[[email protected] ~]# yum remove docker docker-common docker-selinux docker-engine
2、 Install some necessary system tools
[[email protected] ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
3、 To configure docker Stable version repository for
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
4、 Update installation package index
[[email protected] ~]# yum makecache fast
5、 install docker ce
[[email protected] ~]# yum -y install docker-ce-18.06.1.ce-3.el7
6、 Start up and start up automatically docker
[[email protected] ~]# systemctl enable docker && systemctl start docker
7、 see docker edition
[[email protected] ~]# docker --version
8、 Add alicloud YUM Software sources
[[email protected] ~]# vim /etc/yum.repos.d/kubernetes.repo
[Kubernetes]
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
9、
[[email protected] ~]# yum clean all
10、
[[email protected] ~]# yum makecache
install kubeadm,kubelet and kubectl
11、 Due to frequent version updates , The version number deployment is specified here :
[[email protected] ~]# yum install -y kubelet-1.15.0 kubeadm-1.15.0 kubectl-1.15.0
[[email protected] ~]# systemctl enable kubelet
Four 、 Deploy Kubernetes Master( This is in master Operation in the host ):
[[email protected]~]#kubeadm init --apiserver-advertise-address=192.168.8.146 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.15.0 --service-cidr=10.1.0.0/16 --pod-network-cidr=10.244.0.0/16
Be careful :192.168.8.146ip yes master The host ip Address
5、 ... and 、 To configure kubectl Access cluster ( Three machines operate ):
1、
[[email protected] ~]# mkdir -p $HOME/.kube
2、
[[email protected] ~]# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
3、
[[email protected] ~]# chown $(id -u):$(id -g) $HOME/.kube/config
6、 ... and 、Master install flannel( host master In the operation ):
[[email protected]~]#kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
1、 Look at the index pod
[[email protected] ~]# kubectl get pod -n kube-system
2、 Look at the node
[[email protected] ~]# kubectl get node
7、 ... and 、 Join in node node ( On two node Do on ):
1、
[[email protected] ~]# kubeadm join 192.168.8.146:6443 --token vhykt2.0jjdgdcnclxhts41 --discovery-token-ca-cert-hash sha256:bf42d67996e593a1e5844ba717d97e1249ed85bf86d83322b88c108d2f6a3dc1
2、 see node1 Whether the node is successful ( stay node1 Do on )
[[email protected] ~]# docker ps
8、 ... and 、 View node information ( stay master operation )
[[email protected] ~]# kubectl get node
Nine 、 Deploy dashboard(master Host operation )
[[email protected]~]#wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
1、
[[email protected] ~]# vim kubernetes-dashboard.yaml
2、 install dashboard
[[email protected] ~]# kubectl apply -f kubernetes-dashboard.yaml
3、 Use master node ip Address + Port to access , Agreement is https Of
see Dashboard Port information :
[[email protected] ~]# kubectl --namespace=kube-system get service kubernetes-dashboard
4、 Take my own server as the access object , Use https://172.16.204.130:30310 Can access
5、Token
[[email protected] ~]# kubectl create serviceaccount dashboard-admin -n kube-system
[[email protected]~]#kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
[[email protected] ~]# kubectl get secret -n kube-system
6、 see token Specific information
[[email protected]~]# kubectl describe secret dashboard-admin-token-92djb -n kube-system
7、 Enter the secret order in the token
8、 Log in to the successful page :
In this paper, from :https://blog.51cto.com/u_15397018/5367484
边栏推荐
- 计算时间差
- AcWing:第58场周赛
- Input can only input numbers, limited input
- Codeforces Round #798 (Div. 2)A~D
- Luogu P1102 A-B number pair (dichotomy, map, double pointer)
- Configuration du cadre flask loguru log Library
- 树莓派4B安装opencv3.4.0
- Basic Q & A of introductory C language
- Frida hook so layer, protobuf data analysis
- The "sneaky" new asteroid will pass the earth safely this week: how to watch it
猜你喜欢
Codeforces Round #802(Div. 2)A~D
Ball Dropping
Pyside6 signal, slot
Penetration test 2 --- XSS, CSRF, file upload, file inclusion, deserialization vulnerability
Maximum product (greedy)
[exercise-5] (UVA 839) not so mobile (balance)
1689. Ten - the minimum number of binary numbers
Pytorch extract skeleton (differentiable)
C language learning notes
QT implementation fillet window
随机推荐
C language must memorize code Encyclopedia
Anaconda下安装Jupyter notebook
Socket communication
Vs2019 initial use
Codeforces Round #797 (Div. 3)无F
Luogu P1102 A-B number pair (dichotomy, map, double pointer)
Codeforces Round #798 (Div. 2)A~D
快速转 TypeScript 指南
Pyside6 signal, slot
Truck History
去掉input聚焦时的边框
C language learning notes
TCP's three handshakes and four waves
window11 conda安装pytorch过程中遇到的一些问题
Opencv learning log 27 -- chip positioning
Quick to typescript Guide
Problem - 922D、Robot Vacuum Cleaner - Codeforces
JS call camera
顺丰科技智慧物流校园技术挑战赛(无t4)
The concept of C language array