In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Binary deployment of K8s cluster
Configure the nfs server
NFS_SERVER () {yum install-y nfs-utils rpcbindmkdir-pv / nfssystemctl restart nfs rpcbindsystemctl enable nfs rpcbindecho'/ nfs * (rw,no_root_squash)'> / etc/exportsexportfs-ravcd / nfs}
1. The client of nfs sharing
NFS_CLIENT () {yum install-y nfs-utils rpcbindsystemctl restart nfs rpcbindsystemctl enable nfs rpcbindmkdir-pv / nfsshowmount-e 192.168.11.11mount.nfs 192.168.11.11:/nfs / nfsdf-hT}
2. Hostname setting
HOST_NAME () {read-p 'please inpute hostname (eg.srv11):' NAMEHOSTNAME=$ {NAME} hostnamectl-- static set-hostname $HOSTNAMEhostname# modify hosts file grep-E 'node | srv | dk.io' / etc/hosts | | echo' 192.168.11.11 node1 k8s-master srv11192.168.11.12 node2 k8s-node1 srv12192.168.11.13 node3 k8s-node2 srv13192.168.11.14 node4 k8s-node3 srv14192.168.11.11 dk.io' > > / etc/hostscat / etc/hosts}
3. Installation and configuration of etcd and flannel
ETCD_INST () {\ cp-fv / nfs/k8s/k8s.repo / etc/yum.repos.d/yum install-y etcd flannel [- f / etc/etcd/etcd.conf.bak] | | cp-v / etc/etcd/etcd.conf {, .bak} cd/etc / etcd# remove the number # sed-I's cd/etc at the beginning of lines 5, 20, 26, 27, 28. 27s/ ^ # / /; 28s/ ^ # / /; 'etcd.confegrep-nv' ^ # | ^ $'etcd.confsed-I "9 etcd.confsed 26slob defaultlop ${HOSTNAME} /;" etcd.confsed-I "20J 21sLash 0.0.0.0lash ${HOSTNAME} / "etcd.confegrep-nv'^ # | ^ $'etcd.confCluster='ETCD_INITIAL_CLUSTER=" srv11= http://srv11:2380,srv12=http://srv12:2380,srv13=http://srv13:2380"'sed-I "26c ${Cluster}" etcd.confegrep-nv' ^ # | ^ $'etcd.confsed-I' 4s hash 127.0.0.1 / etc/sysconfig/flanneldcat / etc/sysconfig/flanneld
4. Start the etcd service
Systemctl enable etcdsystemctl restart etcdetcdctl get / atomic.io/network/config [$?-eq 0] | | etcdctl mk / atomic.io/network/config'{"Network": "10.0.0.0amp 16"} 'systemctl enable flanneldsystemctl restart flanneld}
5. Install the k8s-master server
K8S_MASTER () {yum install-y docker kubernetessystemctl restart dockersystemctl enable dockerdocker info
6. Modify scripts for apiserver and config files
Cd / etc/kubernetes/sed-I '11s/ ^ # /; 14s/ ^ # / /' apiserversed-I'8s 22s/127.0.0.1/srv11/ 127.0.0.1G 'apiserversed-I "17s 22s/127.0.0.1/srv11/ ${HOSTNAME} /" apiserversed-I "23s 22s/127.0.0.1/srv11/ 22s/127.0.0.1/srv11/ configgrep-Ev' ^ $| ^ # 'apiservercd / etc/kubernetes/sed-I" 22s/127.0.0.1/srv11/ "ServiceAccountMague /" SecurityContextDenyServiceAccountMague / "SecurityContextDenyServiceAccountMagneEffect /" SecurityContextDenyServiceAccountTime / "SecurityContextDenyServiceAccoun
7. K8s-master starts the service and sets boot self-startup
Systemctl enable docker.servicesystemctl restart docker.servicesystemctl enable kube-apiserver.servicesystemctl restart kube-apiserver.servicesystemctl enable kube-controller-manager.servicesystemctl restart kube-controller-manager.servicesystemctl enable kube-scheduler.servicesystemctl restart kube-scheduler.servicekubectl get nodes
8. Visit http://kube-apiserver:port, to view all request url and creation status
Curl http://192.168.11.11:8080 curl http://192.168.11.11:8080/healthz/ping}
9. K8s-node node deployment
# install docker and kubernets (refer to the installation method of k8s-master)
K8S_NODE () {yum install-y docker kubernetessystemctl restart dockersystemctl enable dockerdocker info
10. Modify scripts for config and kubelet files
Cd / etc/kubernetes/MASTER='srv11'sed-I "22s8s/ 127.0.0.1 HOSTNAME ${MASTER} /" configgrep-Ev'^ $| ^ # 'configcd / etc/kubernetes/sed-I "5s/127.0.0.1/0.0.0.0/" kubeletsed-I' 8s/ ^ # / / 'kubeletsed-I "11s HOSTNAME} /" kubeletsed-I "14s/127.0.0.1/srv11/" kubeletgrep-Ev' ^ $| ^ # 'kubelet
11. K8s-node1 starts the service and sets boot self-startup
Systemctl enable docker.servicesystemctl restart docker.servicesystemctl enable kubelet.servicesystemctl restart kubelet.servicesystemctl enable kube-proxy.servicesystemctl restart kube-proxy.servicekubectl-s http://srv11:8080 get nodes}
12. K8s cluster status detection
K8S_STAT () {etcdctl member listetcdctl cluster-healthkubectl-s http://srv11:8080 get node} cat
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.