当前位置:网站首页>Kubernetes cluster deployment
Kubernetes cluster deployment
2022-06-24 19:27:00 【Meng 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 firewalld2、 close selinux:
[[email protected] ~]# sed -i 's/enforcing/disabled/' /etc/selinux/config[[email protected] ~]# getenforce3、 close swap Partition :
Temporarily Closed :
[[email protected] ~]# swapoff -aPermanent 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_forward3、 ... and 、 install docker( All three machines operate )
1、 Uninstall the old version docker
[[email protected] ~]# yum remove docker docker-common docker-selinux docker-engine2、 Install some necessary system tools
[[email protected] ~]# yum install -y yum-utils device-mapper-persistent-data lvm23、 To configure docker Stable version repository for
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo4、 Update installation package index
[[email protected] ~]# yum makecache fast5、 install docker ce
[[email protected] ~]# yum -y install docker-ce-18.06.1.ce-3.el76、 Start up and start up automatically docker
[[email protected] ~]# systemctl enable docker && systemctl start docker7、 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_64enabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg9、
[[email protected] ~]# yum clean all10、
[[email protected] ~]# yum makecacheinstall 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 kubeletFour 、 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/16Be 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/.kube2、
[[email protected] ~]# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config3、
[[email protected] ~]# chown $(id -u):$(id -g) $HOME/.kube/config6、 ... and 、Master install flannel( host master In the operation ):
[[email protected]~]#kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml1、 Look at the index pod
[[email protected] ~]# kubectl get pod -n kube-system2、 Look at the node
[[email protected] ~]# kubectl get node7、 ... 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.yaml1、
[[email protected] ~]# vim kubernetes-dashboard.yaml

2、 install dashboard
[[email protected] ~]# kubectl apply -f kubernetes-dashboard.yaml3、 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
边栏推荐
- subject may not be empty [subject-empty]
- Why is nodejs so fast?
- 【Go语言刷题篇】Go从0到入门4:切片的高级用法、初级复习与Map入门学习
- Introduction to smart contract security audit delegatecall (2)
- Volcano成Spark默认batch调度器
- 佛祖保佑 永无BUG
- At present, only CDC monitors Mysql to get the data of new columns. Sqlserver can't, can it
- STM32 uses time delay to realize breathing lamp register version
- An accident caused by a MySQL misoperation cannot be withstood by High Availability!
- 我链接mysql 报这个错 是啥意思呀?
猜你喜欢

Why are life science enterprises on the cloud in succession?

What other data besides SHP data

试驾 Citus 11.0 beta(官方博客)

Drawing DEM with GEE gracefully

Huawei machine learning service speech recognition function enables applications to paint "sound" and color

怎么使用R包ggtreeExtra绘制进化树

How do programmers do we media?

Download steps of STM32 firmware library

技术实现 | Apache Doris 冷热数据存储(一)

LCD12864 (ST7565P) Chinese character display (STM32F103)
随机推荐
多云模式并非“万能钥匙”
Drawing DEM with GEE gracefully
Pingcap was selected as the "voice of customers" of Gartner cloud database in 2022, and won the highest score of "outstanding performer"
Ask a question. Adbhi supports the retention of 100 databases with the latest IDs. Is this an operation like this
NFT双币质押流动性挖矿系统开发
Server lease error in Hong Kong may lead to serious consequences
技术实现 | Apache Doris 冷热数据存储(一)
Programmers spend most of their time not writing code, but...
R for Data Science (note) -- data transformation (select basic use)
[computer talk club] Lecture 3: how to raise key issues?
Do you have all the basic embedded knowledge points that novices often ignore?
想问下 pgsql cdc 账号同一个 多个 task 会有影响吗,我现在3个task 只有一个 有
Starring develops httpjson access point + Database
Game between apifox and other interface development tools
Application scenarios of channel of go question bank · 11
How to customize cursor position in wechat applet rotation chart
php OSS文件读取和写入文件,workerman生成临时文件并输出浏览器下载
怎么使用R包ggtreeExtra绘制进化树
Why is nodejs so fast?
8 challenges of BSS application cloud native deployment