K8S master 节点 10.10.10.12
k8s Minion节点10.10.10.14
系统centos 7.4
部署操作链接地址:文档:k8s部署手册.note
链接:http://note.youdao.com/noteshare?id=cbaacc7678f024ed6670a5eb803da920&sub=90A090192E4D44F58C79E91A14D960ED
一、master点安装部署步骤:
1、关闭防火墙,开启NTP服务
systemctl stop firewalld #停止防火墙 systemctl disable firewalld #禁用防火墙 yum -y install ntp #安装NTP服务器 ntpdate pool.ntp.org #更新时间同步 systemctl start ntpd #启动NTP setenforce 0 systemctl enable ntpd#enable #NTP关机开机后不需要在开启
2、yum安装相关组件,ETCD可以单独用一台服务器部署,也可以和 MASTER合在一块
yum install epel-release -y #安装eple 扩展源 yum install kubernetes-master etcd flannel -y
3、相关配置文件配置
1)ETCD配置文件如下所示:
备注:可以将原有配置文件情况,直接复制下面内容即可,但是需要修改配置文件对应的IP地址
[root@localhost ~]# more /etc/etcd/etcd.conf # [member] ETCD_NAME=etcd1 ETCD_DATA_DIR="/data/etcd" #ETCD_WAL_DIR="" #ETCD_SNAPSHOT_COUNT="10000" #ETCD_HEARTBEAT_INTERVAL="100" #ETCD_ELECTION_TIMEOUT="1000" ETCD_LISTEN_PEER_URLS="http://10.10.10.12:2380" ETCD_LISTEN_CLIENT_URLS="http://10.10.10.12:2379,http://127.0.0.1:2379" ETCD_MAX_SNAPSHOTS="5" #ETCD_MAX_WALS="5" #ETCD_CORS="" # #[cluster] ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.10.10.12:2380" # if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..." ETCD_INITIAL_CLUSTER="etcd1=http://10.10.10.12:2380" #ETCD_INITIAL_CLUSTER_STATE="new" #ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster" ETCD_ADVERTISE_CLIENT_URLS="http://10.10.10.12:2379" #ETCD_DISCOVERY="" #ETCD_DISCOVERY_SRV="" #ETCD_DISCOVERY_FALLBACK="proxy" #ETCD_DISCOVERY_PROXY="" # #[proxy] #ETCD_PROXY="off" #ETCD_PROXY_FAILURE_WAIT="5000" #ETCD_PROXY_REFRESH_INTERVAL="30000" #ETCD_PROXY_DIAL_TIMEOUT="1000" #ETCD_PROXY_WRITE_TIMEOUT="5000" #ETCD_PROXY_READ_TIMEOUT="0" # #[security] #ETCD_CERT_FILE="" #ETCD_KEY_FILE="" #ETCD_CLIENT_CERT_AUTH="false" #ETCD_TRUSTED_CA_FILE="" #ETCD_PEER_CERT_FILE="" #ETCD_PEER_KEY_FILE="" #ETCD_PEER_CLIENT_CERT_AUTH="false" #ETCD_PEER_TRUSTED_CA_FILE="" # #[logging] #ETCD_DEBUG="false" # examples for -log-package-levels etcdserver=WARNING,security=DEBUG #ETCD_LOG_PACKAGE_LEVELS=""
2)创建ETCD数据目录并 启动etcd
mkdir -p /data/etcd/;chmod 757 -R /data/etcd/ systemctl restart etcd.service
3)查看etcd 进程 是否正常
[root@localhost ~]# ps -ef | grep etcd kube 3161 1 0 16:54 ? 00:02:04 /usr/bin/kube-apiserver --logtostderr=true --v=0 --etcd-servers=http://10.10.10.12:2379 --insecure-bind-address=0.0.0.0 --port=8080 --kubelet-port=10250 --allow-privileged=false --service-cluster-ip-range=10.254.0.0/16 --admission_control=NamespaceLifecycle,NamespaceExists,LimitRanger,ResourceQuota etcd 4267 1 1 19:13 ? 00:01:08 /usr/bin/etcd --name=etcd1 --data-dir=/data/etcd --listen-client-urls=http://10.10.10.12:2379,http://127.0.0.1:2379 root 4299 1 0 19:13 ? 00:00:00 /usr/bin/flanneld -etcd-endpoints=http://10.10.10.12:2379 -etcd-prefix=/atomic.io/network root 4799 4706 0 21:05 pts/0 00:00:00 grep --color=auto etcd
4)配置MASTER节点主配置文件,注意配置文件里面的IP地址,可以将原有配置文件清空 ,复制以下内容即可 。目录如下 [root@localhost ~]# more /etc/kubernetes/config
[root@localhost ~]# more /etc/kubernetes/config ### # kubernetes system config # # The following values are used to configure various aspects of all # kubernetes services, including # # kube-apiserver.service # kube-controller-manager.service # kube-scheduler.service # kubelet.service # kube-proxy.service # logging to stderr means we get it in the systemd journal KUBE_LOGTOSTDERR="--logtostderr=true" # journal message level, 0 is debug KUBE_LOG_LEVEL="--v=0" # Should this cluster be allowed to run privileged Docker containers KUBE_ALLOW_PRIV="--allow-privileged=false" #是否开启docker容器的超级权限,默认不开启,也可以开启为true # How the controller-manager, scheduler, and proxy find the apiserver KUBE_MASTER="--master=http://10.10.10.12:8080"
5)配置api组件配置文件,可以直接复制以下内容,注意IP地址
[root@localhost ~]# [root@localhost ~]# more /etc/kubernetes/apiserver # kubernetes system config # The following values are used to configure the kube-apiserver # The address on the local server to listen to. KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0" # The port on the local server to listen on. KUBE_API_PORT="--port=8080" # Port minions listen on KUBELET_PORT="--kubelet-port=10250" # Comma separated list of nodes in the etcd cluster KUBE_ETCD_SERVERS="--etcd-servers=http://10.10.10.12:2379" # Address range to use for i KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16" #这个配置无需修改 # default admission control policies #KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota" KUBE_ADMISSION_CONTROL="--admission_control=NamespaceLifecycle,NamespaceExists,LimitRanger,ResourceQuota" # Add your own! KUBE_API_ARGS=""
推荐阅读
- Vue 中如何从插槽中发出数据
- Istio+K8s,微服务的双剑合璧
- nginx单节点部署
- Kafka-manager部署与使用简单介绍
- redis5.0.7 版本集群liunx部署简易流程
- Docker不香吗,为啥还要K8s?
- VMware环境部署vFW虚拟防火墙
- 在华为鲲鹏服务器的OpenEuler操作系统中快速部署OpenGauss数据库
- k8s高可用架构部署
- Centos7部署memcached