真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

centos7k8s集群部署

安裝k8s集群前期準(zhǔn)備:
網(wǎng)絡(luò)環(huán)境:

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:申請(qǐng)域名、網(wǎng)絡(luò)空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、黃山網(wǎng)站維護(hù)、網(wǎng)站推廣。

節(jié)點(diǎn)主機(jī)名ip
Master k8s_master 192.168.3.216
Node1 k8s_node1 192.168.3.217
Node2 k8s_node2 192.168.3.219

centos7版本:
  [root@k8s_master ~]# cat /etc/redhat-release
  CentOS Linux release 7.4.1708 (Core)

關(guān)閉firewalld:
  systemctl stop firewalld
  systemctl disable firewalld

三臺(tái)主機(jī)基礎(chǔ)服務(wù)安裝:
  [root@k8s_master ~]#yum -y update
  [root@k8s_master ~]#yum -y install net-tools wget vim ntpd
  [root@k8s_master ~]#systemctl enable ntpd
  [root@k8s_master ~]#systemctl start ntpd

分別在三臺(tái)主機(jī),設(shè)置主機(jī)名:
  Master
  hostnamectl --static set-hostname k8s_master
  Node1
  hostnamectl --static set-hostname k8s_client1
  Node2
  hostnamectl --static set-hostname k8s_client2

設(shè)置hosts,分別再三臺(tái)主機(jī)執(zhí)行:

cat < /etc/hosts
192.168.3.217 k8s_client1
192.168.3.219 k8s_client2
192.168.3.216 k8s_master
EOF

部署Master操作:
  安裝etcd服務(wù):
  [root@k8s_master ~]# yum -y install etcd

編輯配置文件 /etc/etcd/etcd.conf
  [root@k8s_master ~]# cat /etc/etcd/etcd.conf | grep -v "^#"

ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379,http://0.0.0.0:4001"
ETCD_NAME="master"
ETCD_ADVERTISE_CLIENT_URLS="http://k8s_master:2379,http://k8s_master:4001"

  設(shè)置開(kāi)機(jī)啟動(dòng)并驗(yàn)證狀態(tài)
  [root@k8s_master ~]#systemctl enable etcd
  [root@k8s_master ~]#systemctl start etcd

  etcd檢查
  [root@k8s_master ~]# etcdctl -C http://k8s_master:4001 cluster-health
  member 8e9e05c52164694d is healthy: got healthy result from http://k8s_master:2379
  cluster is healthy
  [root@k8s_master ~]# etcdctl -C http://k8s_master:2379 cluster-health
  member 8e9e05c52164694d is healthy: got healthy result from http://k8s_master:2379
  cluster is healthy

安裝docker服務(wù)
  [root@k8s_master ~]# yum -y install docker
  設(shè)置開(kāi)機(jī)啟動(dòng),開(kāi)啟服務(wù):
  [root@k8s_master ~]#systemctl enable docker
  [root@k8s_master ~]#systemctl start docker
查看docker版本:
[root@k8s_master ~]# docker version
Client:
Version: 1.12.6
API version: 1.24
Package version: docker-1.12.6-71.git3e8e77d.el7.centos.1.x86_64
Go version: go1.8.3
Git commit: 3e8e77d/1.12.6
Built: Tue Jan 30 09:17:00 2018
OS/Arch: linux/amd64

Server:
Version: 1.12.6
API version: 1.24
Package version: docker-1.12.6-71.git3e8e77d.el7.centos.1.x86_64
Go version: go1.8.3
Git commit: 3e8e77d/1.12.6
Built: Tue Jan 30 09:17:00 2018
OS/Arch: linux/amd64

安裝kubernetes
  [root@k8s_master ~]# yum install kubernetes

在kubernetes master上需要運(yùn)行以下組件:
  Kubernets API Server
  Kubernets Controller Manager
  Kubernets Scheduler

修改apiserver服務(wù)配置文件:
[root@k8s_master ~]# cat /etc/kubernetes/apiserver | grep -v "^#"

KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--port=8080"
KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.3.216:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
KUBE_API_ARGS=""

修改config配置文件:
[root@k8s_master ~]# cat /etc/kubernetes/config | grep -v "^#"

KUBE_LOGTOSTDERR="--logtostderr=true"
KUBE_LOG_LEVEL="--v=0"
KUBE_ALLOW_PRIV="--allow-privileged=false"
KUBE_MASTER="--master=http://192.168.3.216:8080"

設(shè)置開(kāi)機(jī)啟動(dòng),開(kāi)啟服務(wù)
  [root@k8s_master ~]#systemctl enable kube-apiserver kube-controller-manager kube-scheduler
  [root@k8s_master ~]#systemctl start kube-apiserver kube-controller-manager kube-scheduler

查看服務(wù)端口:
[root@k8s_master ~]# netstat -tnlp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:2380          0.0.0.0:*               LISTEN      973/etcd            
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      970/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1184/master         
tcp6       0      0 :::6443                 :::*                    LISTEN      1253/kube-apiserver 
tcp6       0      0 :::2379                 :::*                    LISTEN      973/etcd            
tcp6       0      0 :::10251                :::*                    LISTEN      675/kube-scheduler  
tcp6       0      0 :::10252                :::*                    LISTEN      674/kube-controller 
tcp6       0      0 :::8080                 :::*                    LISTEN      1253/kube-apiserver 
tcp6       0      0 :::22                   :::*                    LISTEN      970/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1184/master         
tcp6       0      0 :::4001                 :::*                    LISTEN      973/etcd 

部署Node:
安裝docker
   參考Master安裝方法
安裝kubernetes
  參考Master安裝方法
配置、啟動(dòng)kubernetes
  node節(jié)點(diǎn)上需要運(yùn)行一下組件
   kubelet kube-proxy

Node節(jié)點(diǎn)主機(jī)做以下配置:
config:
[root@k8s_client1 ~]# cat /etc/kubernetes/config | grep -v "^#"

KUBE_LOGTOSTDERR="--logtostderr=true"
KUBE_LOG_LEVEL="--v=0"
KUBE_ALLOW_PRIV="--allow-privileged=false"
KUBE_MASTER="--master=http://192.168.3.216:8080"
kubelet:
[root@k8s_client1 ~]# cat /etc/kubernetes/kubelet | grep -v "^#"
KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_HOSTNAME="--hostname-override=192.168.3.217"
KUBELET_API_SERVER="--api-servers=http://192.168.3.216:8080"
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS=""

設(shè)置開(kāi)機(jī)啟動(dòng)、開(kāi)啟服務(wù)
  [root@k8s_client1 ~]# systemctl enable kubelet kube-proxy
  [root@k8s_client1 ~]# systemctl start kubelet kube-proxy

查看端口:
[root@k8s_client1 ~]# netstat -ntlp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      942/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2258/master         
tcp        0      0 127.0.0.1:10248         0.0.0.0:*               LISTEN      17932/kubelet       
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      17728/kube-proxy    
tcp6       0      0 :::10250                :::*                    LISTEN      17932/kubelet       
tcp6       0      0 :::10255                :::*                    LISTEN      17932/kubelet       
tcp6       0      0 :::22                   :::*                    LISTEN      942/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      2258/master         
tcp6       0      0 :::4194                 :::*                    LISTEN      17932/kubelet

Master上查看集群中的節(jié)點(diǎn)及節(jié)點(diǎn)狀態(tài)
  [root@k8s_master ~]# kubectl get node

NAME            STATUS     AGE
127.0.0.1       NotReady   1d
192.168.3.217   Ready      1d
192.168.3.219   Ready      1d

  [root@k8s_master ~]# kubectl -s http://k8s_master:8080 get node

NAME            STATUS     AGE
127.0.0.1       NotReady   1d
192.168.3.217   Ready      1d
192.168.3.219   Ready      1d

kubernetes集群搭建完成,還需flannel安裝
flannel是CoreOS提供用于解決Dokcer集群跨主機(jī)通訊的覆蓋網(wǎng)絡(luò)工具。它的主要思路是:預(yù)先留出一個(gè)網(wǎng)段,每個(gè)主機(jī)使用其中一部分,然后每個(gè)容器被分配不同的ip;讓所有的容器認(rèn)為大家在同一個(gè)直連的網(wǎng)絡(luò),底層通過(guò)UDP/VxLAN等進(jìn)行報(bào)文的封裝和轉(zhuǎn)發(fā)。

Master/Node上flannel安裝:
  [root@k8s_master ~]#yum install flannel

flannel配置:
  Master/Node上修改/etc/sysconfig/flanneld

Master:
  [root@k8s_master ~]# cat /etc/sysconfig/flanneld | grep -v "^#"

FLANNEL_ETCD_ENDPOINTS="http://192.168.3.216:2379"
FLANNEL_ETCD_PREFIX="/atomic.io/network"

Node:
  [root@k8s_client1 ~]# cat /etc/sysconfig/flanneld | grep -v "^#"

FLANNEL_ETCD_ENDPOINTS="http://192.168.3.216:2379"
FLANNEL_ETCD_PREFIX="/atomic.io/network"

添加網(wǎng)絡(luò):
[root@k8s_master ~]#etcdctl mk //atomic.io/network/config '{"Network":"172.8.0.0/16"}'

Master/Node設(shè)置服務(wù)開(kāi)機(jī)啟動(dòng)
[root@k8s_master ~]# systemctl enable flanneld
[root@k8s_master ~]# systemctl start flanneld

Master/Node節(jié)點(diǎn)重啟服務(wù):
Master:

for SERVICES in docker kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES ; done

Node:
  [root@k8s_client1 ~]#systemctl restart kube-proxy kubelet docker

查看flannel網(wǎng)絡(luò):
  Master節(jié)點(diǎn):
[root@k8s_master ~]# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:50:56:98:3b:d4 brd ff:ff:ff:ff:ff:ff
inet 192.168.3.216/24 brd 192.168.3.255 scope global ens160
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe98:3bd4/64 scope link
valid_lft forever preferred_lft forever
3: flannel0: mtu 1472 qdisc pfifo_fast state UNKNOWN qlen 500
link/none
inet 10.8.57.0/16 scope global flannel0
valid_lft forever preferred_lft forever
inet6 fe80::3578:6e81:8dc9:ed82/64 scope link flags 800
valid_lft forever preferred_lft forever
4: docker0: mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:8b:7c:fd:8d brd ff:ff:ff:ff:ff:ff
inet 10.8.57.1/24 scope global docker0
valid_lft forever preferred_lft forever

  Node節(jié)點(diǎn):
[root@k8s_client1 ~]# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:50:56:98:65:e0 brd ff:ff:ff:ff:ff:ff
inet 192.168.3.217/24 brd 192.168.3.255 scope global ens160
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe98:65e0/64 scope link
valid_lft forever preferred_lft forever
4: docker0: mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:23:4b:85:6f brd ff:ff:ff:ff:ff:ff
inet 10.8.6.1/24 scope global docker0
valid_lft forever preferred_lft forever
9: flannel0: mtu 1472 qdisc pfifo_fast state UNKNOWN qlen 500
link/none
inet 10.8.6.0/16 scope global flannel0
valid_lft forever preferred_lft forever
inet6 fe80::827:f63e:34ee:1f8e/64 scope link flags 800
valid_lft forever preferred_lft forever


網(wǎng)站名稱:centos7k8s集群部署
文章鏈接:http://weahome.cn/article/gijjji.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部