目录

kubernetes的五个组件

master节点的三个组件
kube-apiserver
整个集群的唯一入口,并提供认证、授权、访问控制、API注册和发现等机制。
kube-controller-manager
控制器管理器
负责维护集群的状态,比如故障检测、自动扩展、滚动更新等。保证资源到达期望值。
kube-scheduler
调度器
经过策略调度POD到合适的节点上面运行。分别有预选策略和优选策略。
node节点的两个组件
kubelet
在集群节点上运行的代理,kubelet会通过各种机制来确保容器处于运行状态且健康。kubelet不会管理不是由kubernetes创建的容器。kubelet接收POD的期望状态(副本数、镜像、网络等),并调用容器运行环境来实现预期状态。
kubelet会定时汇报节点的状态给apiserver,作为scheduler调度的基础。kubelet会对镜像和容器进行清理,避免不必要的文件资源占用。
kube-proxy
kube-proxy是集群中节点上运行的网络代理,是实现service资源功能组件之一。kube-proxy建立了POD网络和集群网络之间的关系。不同node上的service流量转发规则会通过kube-proxy来调用apiserver访问etcd进行规则更新。
service流量调度方式有三种方式:userspace(废弃,性能很差)、iptables(性能差,复杂,即将废弃)、ipvs(性能好,转发方式清晰)。

1.集群架构

主机名 IP地址
hdss7-11.host.com 10.4.7.11
hdss7-12.host.com 10.4.7.12
hdss7-21.host.com 10.4.7.21
hdss7-22.host.com 10.4.7.22
hdss7-200.host.com 10.4.7.200

2.基础环境准备

2.1.系统设置
2.1.1.设置主机名
hostnamectl set-hostname hdss7-xx.host.com
2.1.2.关闭防火墙和selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
2.1.3.设置网卡
cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=10.4..xx
NETMASK=255.255.255.0
GATEWAY=10.4.7.254
DNS1=10.4.7.254
2.1.4.设置yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
2.1.5.安装常用工具
yum install wget net-tools telnet tree nmap sysstat lrzsz dos2unix bind-utils -y
2.2.安装bind服务

hdss7-11.host.com 上

2.2.1.安装bind 9
yum install bind -y
2.2.2.配置bind 9
vi /etc/named.conf
listen-on port { 10.4.7.11; };
allow-query { any; };
forwarders { 10.4.7.254; };
recursion yes;
dnssec-enable no;
dnssec-validation no
##########
named-checkconf
vi /etc/named.rfc1912.zones
zone "host.com" IN {
type master;
file "host.com.zone";
allow-update { 10.4.7.11; };
}; zone "fx.com" IN {
type master;
file "fx.com.zone";
allow-update { 10.4.7.11; };
};
##########
vi /var/named/host.com.zone
$ORIGIN host.com.
$TTL ; minutes
@ IN SOA dns.host.com. dnsadmin.host.com. (
; serial
; refresh ( hours)
; retry ( minutes)
; expire ( week)
; minimum ( day)
)
NS dns.host.com.
$TTL ; minute
dns A 10.4.7.11
HDSS7- A 10.4.7.11
HDSS7- A 10.4.7.12
HDSS7- A 10.4.7.21
HDSS7- A 10.4.7.22
HDSS7- A 10.4.7.200
##########
vi /var/named/fx.com.zone
$ORIGIN fx.com.
$TTL ; minutes
@ IN SOA dns.fx.com. dnsadmin.fx.com. (
; serial
; refresh ( hours)
; retry ( minutes)
; expire ( week)
; minimum ( day)
)
NS dns.fx.com.
$TTL ; minute
dns A 10.4.7.11
2.2.3.检查配置并启动bind 9
named-checkconf
systemctl start named
netstat -lntup|grep
2.2.4.检查
[root@hdss7- ~]# dig -t A hdss7-.host.com @10.4.7.11 +short
10.4.7.11
[root@hdss7- ~]# dig -t A hdss7-.host.com @10.4.7.11 +short
10.4.7.12
[root@hdss7- ~]# dig -t A hdss7-.host.com @10.4.7.11 +short
10.4.7.21
[root@hdss7- ~]# dig -t A hdss7-.host.com @10.4.7.11 +short
10.4.7.22
[root@hdss7- ~]# dig -t A hdss7-.host.com @10.4.7.11 +short
10.4.7.200
2.2.5.配置DNS客户端

Linux所有主机

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DNS1=10.4.7.11
##########
vi /etc/resolv.conf
search host.com
nameserver 10.4.7.11
##########
systemctl restart network

Windows主机

wmnet8网卡更改DNS:10.4.7.11
2.2.6.检查

Linux

ping www.baidu.com
ping hdss7-

Windows

ping hdss7-.host.com
2.3.准备签发证书环境

hdss7-200.host.com 上

2.3.1.安装cfssl
wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -O /usr/bin/cfssl
wget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -O /usr/bin/cfssl-json
wget https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64 -O /usr/bin/cfssl-certinfo
chmod +x /usr/bin/cfssl*
2.3.2.创建生成ca证书csr的json配置文件
mkdir /opt/certs
vi /opt/certs/ca-csr.json
{
"CN": "OldboyEdu",
"hosts": [
],
"key": {
"algo": "rsa",
"size":
},
"names": [
{
"C": "CN",
"ST": "beijing",
"L": "beijing",
"O": "od",
"OU": "ops"
}
],
"ca": {
"expiry": "175200h"
}
}
2.3.3.生成ca证书文件
cd /opt/certs
cfssl gencert -initca ca-csr.json | cfssl-json -bare ca
ll
ca.csr
ca-csr.json
ca-key.pem
ca.pem
2.4.部署docker

hdss7-21.host.com,hdss7-22.host.com,hdss7-200.host.com上

2.4.1.安装
[root@hdss7- ~]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
2.4.2.配置
mkdir  /etc/docker
vi /etc/docker/daemon.json
{
"graph": "/data/docker",
"storage-driver": "overlay2",
"insecure-registries": ["registry.access.redhat.com","quay.io","harbor.fx.com"],
"registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],
"bip": "172.7.21.1/24",
"exec-opts": ["native.cgroupdriver=systemd"],
"live-restore": true
}
##########
bip要根据宿主机ip变化
注意:hdss7-.host.com bip 172.7.21.1/
hdss7-.host.com bip 172.7.22.1/
hdss7-.host.com bip 172.7.200.1/
2.4.3.启动
mkdir -p /data/docker
systemctl start docker
systemctl enable docker
docker --version
2.5.部署docker镜像私有仓库harbor

hdss7-200.host.com 上

2.5.1.下载软件并解压
harbor官网github地址
https://github.com/goharbor/harbor
[root@hdss7- src]# tar xf harbor-offline-installer-v1.8.3.tgz -C /opt/
[root@hdss7- opt]# mv harbor/ harbor-v1.8.3
[root@hdss7- opt]# ln -s /opt/harbor-v1.8.3/ /opt/harbor
2.5.2.配置
[root@hdss7- opt]# vi /opt/harbor/harbor.yml
hostname: harbor.fx.com
http:
port:
harbor_admin_password:Harbor12345
data_volume: /data/harbor
log:
level: info
rotate_count:
rotate_size:200M
location: /data/harbor/logs [root@hdss7- opt]# mkdir -p /data/harbor/logs
2.5.3.安装docker-compose
[root@hdss7- opt]# yum install docker-compose -y
2.5.4.安装harbor
[root@hdss7- harbor]# ./install.sh 
2.5.5.检查harbor启动情况
[root@hdss7- harbor]# docker-compose ps
[root@hdss7- harbor]# docker ps -a
2.5.6.配置harbor的dns内网解析
[root@hdss7- ~]# vi /var/named/od.com.zone
; serial
harbor A 10.4.7.200
[root@hdss7- ~]# systemctl restart named
[root@hdss7- ~]# dig -t A harbor.fx.com +short
10.4.7.200
2.5.7.安装NGINX并配置
[root@hdss7- harbor]# yum install nginx -y
[root@hdss7- harbor]# vi /etc/nginx/conf.d/harbor.fx.com.conf
server {
listen ;
server_name harbor.fx.com; client_max_body_size 1000m; location / {
proxy_pass http://127.0.0.1:180;
}
}
[root@hdss7- harbor]# nginx -t
[root@hdss7- harbor]# systemctl start nginx
[root@hdss7- harbor]# systemctl enable nginx
2.5.8.浏览器打开harbor.fx.com并测试
[root@hdss7- ~]# curl harbor.fx.com

1、浏览器输入:harbor.fx.com 用户名:admin 密码:Harbor12345

2、新建项目:public 访问级别:公开

3、下载镜像并给镜像打tag

[root@hdss7- harbor]# docker pull nginx:1.7.
[root@hdss7- harbor]# docker images |grep 1.7.
[root@hdss7- harbor]# docker tag 84581e99d807 harbor.fx.com/public/nginx:v1.7.9

4、登录harbor并上传到仓库

[root@hdss7- harbor]# docker login harbor.fx.com
[root@hdss7- harbor]# docker push harbor.fx.com/public/nginx:v1.7.9
2.5.9.检查

可以看到NGINX镜像已经上传到public下

3.部署master节点

3.1.部署etcd集群
3.1.1.集群架构
主机名 角色 ip地址
hdss7-12.host.com lead 10.4.7.12
hdss7-21.host.com follow 10.4.7.21
hdss7-22.host.com follow 10.4.7.22

部署方法以hdss7-12.host.com为例

3.1.2.创建基于根证书的config配置文件

hdss7-200上

[root@hdss7- ~]# vi /opt/certs/ca-config.json
{
"signing": {
"default": {
"expiry": "175200h"
},
"profiles": {
"server": {
"expiry": "175200h",
"usages": [
"signing",
"key encipherment",
"server auth"
]
},
"client": {
"expiry": "175200h",
"usages": [
"signing",
"key encipherment",
"client auth"
]
},
"peer": {
"expiry": "175200h",
"usages": [
"signing",
"key encipherment",
"server auth",
"client auth"
]
}
}
}
}
3.1.3.创建生成自签发证书的csr的json配置文件
[root@hdss7- ~]# vi /opt/certs/etcd-peer-csr.json
{
"CN": "k8s-etcd",
"hosts": [
"10.4.7.11",
"10.4.7.12",
"10.4.7.21",
"10.4.7.22"
],
"key": {
"algo": "rsa",
"size":
},
"names": [
{
"C": "CN",
"ST": "beijing",
"L": "beijing",
"O": "od",
"OU": "ops"
}
]
}
3.1.4.生成etcd证书文件
[root@hdss7- ~]# cd /opt/certs/
[root@hdss7- certs]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=peer etcd-peer-csr.json |cfssl-json -bare etcd-peer
3.1.5.检查生成的证书文件
[root@hdss7- certs]# ll
etcd-peer.csr
etcd-peer-csr.json
etcd-peer-key.pem
etcd-peer.pem
3.1.6.创建etcd用户

hdss7-12上

[root@hdss7- opt]# useradd -s /sbin/nologin -M etcd
3.1.7.下载软件,解压,做软连接
https://github.com/etcd-io/etcd/tags
[root@hdss7- src]# tar xf etcd-v3.1.20-linux-amd64.tar.gz -C /opt/
[root@hdss7- src]# cd ..
[root@hdss7- opt]# mv etcd-v3.1.20-linux-amd64/ etcd-v3.1.20
[root@hdss7- opt]# ln -s /opt/etcd-v3.1.20/ /opt/etcd
3.1.8.创建目录,拷贝证书文件

创建证书目录、数据目录、日志目录

[root@hdss7- opt]# mkdir -p /opt/etcd/certs /data/etcd /data/logs/etcd-server

拷贝生成的证书文件

[root@hdss7- certs]# scp hdss7-:/opt/certs/ca.pem .
[root@hdss7- certs]# scp hdss7-:/opt/certs/etcd-peer.pem .
[root@hdss7- certs]# scp hdss7-:/opt/certs/etcd-peer-key.pem .
3.1.9.创建etcd服务启动脚本
[root@hdss7- ~]# vi /opt/etcd/etcd-server-startup.sh
#!/bin/sh
./etcd --name etcd-server-- \
--data-dir /data/etcd/etcd-server \
--listen-peer-urls https://10.4.7.12:2380 \
--listen-client-urls https://10.4.7.12:2379,http://127.0.0.1:2379 \
--quota-backend-bytes \
--initial-advertise-peer-urls https://10.4.7.12:2380 \
--advertise-client-urls https://10.4.7.12:2379,http://127.0.0.1:2379 \
--initial-cluster etcd-server--=https://10.4.7.12:2380,etcd-server-7-21=https://10.4.7.21:2380,etcd-server-7-22=https://10.4.7.22:2380 \
--ca-file ./certs/ca.pem \
--cert-file ./certs/etcd-peer.pem \
--key-file ./certs/etcd-peer-key.pem \
--client-cert-auth \
--trusted-ca-file ./certs/ca.pem \
--peer-ca-file ./certs/ca.pem \
--peer-cert-file ./certs/etcd-peer.pem \
--peer-key-file ./certs/etcd-peer-key.pem \
--peer-client-cert-auth \
--peer-trusted-ca-file ./certs/ca.pem \
--log-output stdout
[root@hdss7- ~]# chmod +x /opt/etcd/etcd-server-startup.sh
3.1.10.授权目录权限
[root@hdss7- ~]# chown -R etcd.etcd /opt/etcd-v3.1.20/   /data/etcd/  /data/logs/etcd-server/
3.1.11.安装supervisor软件
[root@hdss7- ~]# yum install supervisor -y
[root@hdss7- ~]# systemctl start supervisord
[root@hdss7- ~]# systemctl enable supervisord
3.1.12.创建supervisor配置
[root@hdss7- ~]# vi /etc/supervisord.d/etcd-server.ini
[program:etcd-server--]
command=/opt/etcd/etcd-server-startup.sh ; the program (relative uses PATH, can take args)
numprocs= ; number of processes copies to start (def )
directory=/opt/etcd ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs= ; number of secs prog must stay running (def. )
startretries= ; max # of serial start failures (default )
exitcodes=, ; 'expected' exit codes for process (default ,)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
user=etcd ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/etcd-server/etcd.stdout.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups= ; # of stdout logfile backups (default )
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stdout_events_enabled=false ; emit events on stdout writes (default false)
3.1.13.启动etcd服务并检查
[root@hdss7- ~]# supervisorctl update
[root@hdss7- ~]# supervisorctl status
[root@hdss7- ~]# netstat -lntup|grep etcd
3.1.14.部署启动所有集群

不同的地方

/opt/etcd/etcd-server-startup.sh
--name
--listen-peer-urls
--listen-client-urls
--initial-advertise-peer-urls
--advertise-client-urls
##########
/etc/supervisord.d/etcd-server.ini
[program:etcd-server--]
3.1.15.检查集群状态
[root@hdss7- etcd]# ./etcdctl  cluster-health
[root@hdss7- etcd]# ./etcdctl member list
3.2.部署kube-apiserver集群
3.2.1.集群架构
主机名 角色 ip地址
hdss7-21.host.com kube-apiserver 10.4.7.21
hdss7-22.host.com kube-apiserver 10.4.7.22

部署方法以hdss7-21.host.com为例

3.2.2.下载软件,解压,做软连接

hdss7-21.host.com上

https://github.com/kubernetes/kubernetes/releases/tag/v1.15.2
CHANGELOG-1.15.md--→server binaries--→kubernetes-server-linux-amd64.tar.gz
[root@hdss7- src]# tar xf kubernetes-server-linux-amd64-v1.15.2.tar.gz -C /opt
[root@hdss7- opt]# mv kubernetes/ kubernetes-v1.15.2
[root@hdss7- opt]# ln -s /opt/kubernetes-v1.15.2/ /opt/kubernetes
[root@hdss7- opt]# cd kubernetes
[root@hdss7- kubernetes]# rm -rf kubernetes-src.tar.gz
[root@hdss7- kubernetes]# cd server/bin
[root@hdss7- bin]# rm -f *.tar
[root@hdss7- bin]# rm -f *_tag
3.2.3.签发client证书

hdss7-200.host.com上

1、创建生成证书csr的json配置文件

[root@hdss7- certs]#  vi /opt/certs/client-csr.json
{
"CN": "k8s-node",
"hosts": [
],
"key": {
"algo": "rsa",
"size":
},
"names": [
{
"C": "CN",
"ST": "beijing",
"L": "beijing",
"O": "od",
"OU": "ops"
}
]
}

2、生成client证书文件

[root@hdss7- certs]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client client-csr.json |cfssl-json -bare client
3、检查生成的证书文件
[root@hdss7- certs]# ll
client.csr
client-csr.json
client-key.pem
client.pem
3.2.4.签发kube-apiserver证书

hdss7-200.host.com上

1、创建生成证书csr的json配置文件

[root@hdss7- certs]# vi /opt/certs/apiserver-csr.json
{
"CN": "k8s-apiserver",
"hosts": [
"127.0.0.1",
"192.168.0.1",
"kubernetes.default",
"kubernetes.default.svc",
"kubernetes.default.svc.cluster",
"kubernetes.default.svc.cluster.local",
"10.4.7.10",
"10.4.7.21",
"10.4.7.22",
"10.4.7.23"
],
"key": {
"algo": "rsa",
"size":
},
"names": [
{
"C": "CN",
"ST": "beijing",
"L": "beijing",
"O": "od",
"OU": "ops"
}
]
}

2、生成kube-apiserver证书文件

[root@hdss7- certs]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server apiserver-csr.json |cfssl-json -bare apiserver

3、检查生成的证书文件

[root@hdss7- certs]# ll
apiserver.csr
apiserver-csr.json
apiserver-key.pem
apiserver.pem
3.2.5.拷贝证书文件至各节点,并创建配置

1、拷贝证书文件到/opt/kubernetes/server/bin/cert目录下

[root@hdss7- cert]# scp hdss7-:/opt/certs/ca.pem .
[root@hdss7- cert]# scp hdss7-:/opt/certs/ca-key.pem .
[root@hdss7- cert]# scp hdss7-:/opt/certs/client.pem .
[root@hdss7- cert]# scp hdss7-:/opt/certs/client-key.pem .
[root@hdss7- cert]# scp hdss7-:/opt/certs/apiserver.pem .
[root@hdss7- cert]# scp hdss7-:/opt/certs/apiserver-key.pem .

2、创建配置

[root@hdss7- bin]# mkdir conf
[root@hdss7- conf]# vi audit.yaml
apiVersion: audit.k8s.io/v1beta1 # This is required.
kind: Policy
# Don't generate audit events for all requests in RequestReceived stage.
omitStages:
- "RequestReceived"
rules:
# Log pod changes at RequestResponse level
- level: RequestResponse
resources:
- group: ""
# Resource "pods" doesn't match requests to any subresource of pods,
# which is consistent with the RBAC policy.
resources: ["pods"]
# Log "pods/log", "pods/status" at Metadata level
- level: Metadata
resources:
- group: ""
resources: ["pods/log", "pods/status"] # Don't log requests to a configmap called "controller-leader"
- level: None
resources:
- group: ""
resources: ["configmaps"]
resourceNames: ["controller-leader"] # Don't log watch requests by the "system:kube-proxy" on endpoints or services
- level: None
users: ["system:kube-proxy"]
verbs: ["watch"]
resources:
- group: "" # core API group
resources: ["endpoints", "services"] # Don't log authenticated requests to certain non-resource URL paths.
- level: None
userGroups: ["system:authenticated"]
nonResourceURLs:
- "/api*" # Wildcard matching.
- "/version" # Log the request body of configmap changes in kube-system.
- level: Request
resources:
- group: "" # core API group
resources: ["configmaps"]
# This rule only applies to resources in the "kube-system" namespace.
# The empty string "" can be used to select non-namespaced resources.
namespaces: ["kube-system"] # Log configmap and secret changes in all other namespaces at the Metadata level.
- level: Metadata
resources:
- group: "" # core API group
resources: ["secrets", "configmaps"] # Log all other resources in core and extensions at the Request level.
- level: Request
resources:
- group: "" # core API group
- group: "extensions" # Version of group should NOT be included. # A catch-all rule to log all other requests at the Metadata level.
- level: Metadata
# Long-running requests like watches that fall under this rule will not
# generate an audit event in RequestReceived.
omitStages:
- "RequestReceived"
3.2.6.创建apiserver启动脚本
[root@hdss7- bin]# vi /opt/kubernetes/server/bin/kube-apiserver.sh
#!/bin/bash
./kube-apiserver \
--apiserver-count \
--audit-log-path /data/logs/kubernetes/kube-apiserver/audit-log \
--audit-policy-file ./conf/audit.yaml \
--authorization-mode RBAC \
--client-ca-file ./cert/ca.pem \
--requestheader-client-ca-file ./cert/ca.pem \
--enable-admission-plugins NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota \
--etcd-cafile ./cert/ca.pem \
--etcd-certfile ./cert/client.pem \
--etcd-keyfile ./cert/client-key.pem \
--etcd-servers https://10.4.7.12:2379,https://10.4.7.21:2379,https://10.4.7.22:2379 \
--service-account-key-file ./cert/ca-key.pem \
--service-cluster-ip-range 192.168.0.0/ \
--service-node-port-range - \
--target-ram-mb= \
--kubelet-client-certificate ./cert/client.pem \
--kubelet-client-key ./cert/client-key.pem \
--log-dir /data/logs/kubernetes/kube-apiserver \
--tls-cert-file ./cert/apiserver.pem \
--tls-private-key-file ./cert/apiserver-key.pem \
--v
3.2.7.授权和创建目录
 [root@hdss7- bin]# chmod +x kube-apiserver.sh
[root@hdss7- bin]# mkdir -p /data/logs/kubernetes/kube-apiserver
3.2.8.创建supervisor配置
[root@hdss7- bin]#  vi /etc/supervisord.d/kube-apiserver.ini
[program:kube-apiserver--]
command=/opt/kubernetes/server/bin/kube-apiserver.sh ; the program (relative uses PATH, can take args)
numprocs= ; number of processes copies to start (def )
directory=/opt/kubernetes/server/bin ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs= ; number of secs prog must stay running (def. )
startretries= ; max # of serial start failures (default )
exitcodes=, ; 'expected' exit codes for process (default ,)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
user=root ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/kubernetes/kube-apiserver/apiserver.stdout.log ; stderr log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups= ; # of stdout logfile backups (default )
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stdout_events_enabled=false ; emit events on stdout writes (default false)
3.2.9.启动服务并检查
[root@hdss7- bin]# supervisorctl update
[root@hdss7- bin]# supervisorctl status
[root@hdss7- bin]# netstat -nltup|grep kube-api
3.2.10.部署启动所有集群

不同的地方

/etc/supervisord.d/kube-apiserver.ini
[program:kube-apiserver--]
3.3.部署四层反向代理
3.3.1.集群架构
主机名 角色 IP地址 VIP地址
hdss7-11.host.com L4 10.4.7.11 10.4.7.10
hdss7-12.host.com L4 10.4.7.12 10.4.7.10
3.3.2.安装NGINX和keepalived

1、hdss7-11.host.com和hdss7-12.host.com都安装NGINX和keepalived

[root@hdss7- etcd]# yum install nginx keepalived -y

2、hdss7-11.host.com和hdss7-12.host.com配置NGINX

[root@hdss7- conf.d]# vi /etc/nginx/nginx.conf
stream {
upstream kube-apiserver {
server 10.4.7.21: max_fails= fail_timeout=30s;
server 10.4.7.22: max_fails= fail_timeout=30s;
}
server {
listen ;
proxy_connect_timeout 2s;
proxy_timeout 900s;
proxy_pass kube-apiserver;
}
}
[root@hdss7- etcd]# nginx -t

3、hdss7-11.host.com和hdss7-12.host.com配置keepalived

检查脚本
[root@hdss7- ~]# vi /etc/keepalived/check_port.sh
#!/bin/bash
#keepalived 监控端口脚本
#使用方法:
#在keepalived的配置文件中
#vrrp_script check_port {#创建一个vrrp_script脚本,检查配置
# script "/etc/keepalived/check_port.sh 6379" #配置监听的端口
# interval #检查脚本的频率,单位(秒)
#}
CHK_PORT=$
if [ -n "$CHK_PORT" ];then
PORT_PROCESS=`ss -lnt|grep $CHK_PORT|wc -l`
if [ $PORT_PROCESS -eq ];then
echo "Port $CHK_PORT Is Not Used,End."
exit
fi
else
echo "Check Port Cant Be Empty!"
fi [root@hdss7- ~]# chmod +x /etc/keepalived/check_port.sh
##########
配置文件
keepalived 主:
[root@hdss7- conf.d]# vi /etc/keepalived/keepalived.conf ! Configuration File for keepalived global_defs {
router_id 10.4.7.11 } vrrp_script chk_nginx {
script "/etc/keepalived/check_port.sh 7443"
interval
weight -
} vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id
priority
advert_int
mcast_src_ip 10.4.7.11
nopreempt authentication {
auth_type PASS
auth_pass
}
track_script {
chk_nginx
}
virtual_ipaddress {
10.4.7.10
}
} keepalived 从:
[root@hdss7- conf.d]# vi /etc/keepalived/keepalived.conf ! Configuration File for keepalived
global_defs {
router_id 10.4.7.12
}
vrrp_script chk_nginx {
script "/etc/keepalived/check_port.sh 7443"
interval
weight -
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id
mcast_src_ip 10.4.7.12
priority
advert_int
authentication {
auth_type PASS
auth_pass
}
track_script {
chk_nginx
}
virtual_ipaddress {
10.4.7.10
}
} nopreempt:非抢占式
3.3.3.启动代理并检查
systemctl start nginx keepalived
systemctl enable nginx keepalived
netstat -lntup|grep nginx
ip addr
3.4.部署controller-manager
3.4.1.集群架构
主机名 角色 IP地址
hdss7-21.host.com controller-manager 10.4.7.21
hdss7-22.host.com controller-manager 10.4.7.22

部署方法以hdss7-21.host.com为例

3.4.2.创建启动脚本

hdss7-21.host.com上

[root@hdss7- bin]# vi /opt/kubernetes/server/bin/kube-controller-manager.sh
#!/bin/sh
./kube-controller-manager \
--cluster-cidr 172.7.0.0/ \
--leader-elect true \
--log-dir /data/logs/kubernetes/kube-controller-manager \
--master http://127.0.0.1:8080 \
--service-account-private-key-file ./cert/ca-key.pem \
--service-cluster-ip-range 192.168.0.0/ \
--root-ca-file ./cert/ca.pem \
--v
3.4.3.授权文件权限,创建目录
[root@hdss7- bin]# chmod +x /opt/kubernetes/server/bin/kube-controller-manager.sh
[root@hdss7- bin]# mkdir -p /data/logs/kubernetes/kube-controller-manager
3.4.4.创建supervisor配置
[root@hdss7- bin]# vi /etc/supervisord.d/kube-conntroller-manager.ini
[program:kube-controller-manager--]
command=/opt/kubernetes/server/bin/kube-controller-manager.sh ; the program (relative uses PATH, can take args)
numprocs= ; number of processes copies to start (def )
directory=/opt/kubernetes/server/bin ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs= ; number of secs prog must stay running (def. )
startretries= ; max # of serial start failures (default )
exitcodes=, ; 'expected' exit codes for process (default ,)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
user=root ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/kubernetes/kube-controller-manager/controller.stdout.log ; stderr log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups= ; # of stdout logfile backups (default )
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stdout_events_enabled=false ; emit events on stdout writes (default false)
3.4.5.启动服务并检查
[root@hdss7- bin]# supervisorctl update
[root@hdss7- bin]# supervisorctl status
3.4.6.部署启动所有集群

不同的地方

/etc/supervisord.d/kube-conntroller-manager.ini
[program:kube-controller-manager--]
3.5.部署kube-scheduler
3.5.1.集群架构
主机名 角色 IP地址
hdss7-21.host.com kube-scheduler 10.4.7.21
hdss7-22.host.com kube-scheduler 10.4.7.22

部署方法以hdss7-21.host.com为例

3.5.2.创建启动脚本

hdss7-21.host.com上

[root@hdss7- bin]# vi /opt/kubernetes/server/bin/kube-scheduler.sh
#!/bin/sh
./kube-scheduler \
--leader-elect \
--log-dir /data/logs/kubernetes/kube-scheduler \
--master http://127.0.0.1:8080 \
--v
3.5.3.授权文件权限,创建目录
[root@hdss7- bin]# chmod +x  /opt/kubernetes/server/bin/kube-scheduler.sh
[root@hdss7- bin]# mkdir -p /data/logs/kubernetes/kube-scheduler
3.5.4.创建supervisor配置
[root@hdss7- bin]# vi /etc/supervisord.d/kube-scheduler.ini
[program:kube-scheduler--]
command=/opt/kubernetes/server/bin/kube-scheduler.sh ; the program (relative uses PATH, can take args)
numprocs= ; number of processes copies to start (def )
directory=/opt/kubernetes/server/bin ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs= ; number of secs prog must stay running (def. )
startretries= ; max # of serial start failures (default )
exitcodes=, ; 'expected' exit codes for process (default ,)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
user=root ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/kubernetes/kube-scheduler/scheduler.stdout.log ; stderr log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups= ; # of stdout logfile backups (default )
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stdout_events_enabled=false ; emit events on stdout writes (default false)
3.5.5.启动服务并检查
[root@hdss7- bin]# supervisorctl update
[root@hdss7- bin]# supervisorctl status
3.5.6.部署启动所有集群

不同的地方

/etc/supervisord.d/kube-scheduler.ini
[program:kube-scheduler--]
3.6.检查master节点
3.6.1.建立kubectl软链接
[root@hdss7- bin]#  ln -s /opt/kubernetes/server/bin/kubectl /usr/bin/kubectl
3.6.2.检查master节点
[root@hdss7- bin]# kubectl get cs

4.部署node节点

4.1.部署kubelet
4.1.1.集群架构
主机名 角色 IP地址
hdss7-21.host.com kubelet 10.4.7.21
hdss7-22.host.com kubelet 10.4.7.22

部署方法以hdss7-21.host.com为例

4.1.2.签发kubelet证书

hdss7-200.host.com上

1、创建生成证书csr的json配置文件

[root@hdss7- certs]# vi kubelet-csr.json
{
"CN": "k8s-kubelet",
"hosts": [
"127.0.0.1",
"10.4.7.10",
"10.4.7.21",
"10.4.7.22",
"10.4.7.23",
"10.4.7.24",
"10.4.7.25",
"10.4.7.26",
"10.4.7.27",
"10.4.7.28"
],
"key": {
"algo": "rsa",
"size":
},
"names": [
{
"C": "CN",
"ST": "beijing",
"L": "beijing",
"O": "od",
"OU": "ops"
}
]
}

2、生成kubelet证书文件

[root@hdss7- certs]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server kubelet-csr.json | cfssl-json -bare kubelet
3、检查生成的证书文件
[root@hdss7- certs]# ll
kubelet.csr
kubelet-csr.json
kubelet-key.pem
kubelet.pem
4.1.3.拷贝证书文件至各节点,并创建配置

hdss7-21.host.com上

1、拷贝证书文件

[root@hdss7- cert]# scp hdss7-:/opt/certs/kubelet.pem .
[root@hdss7- cert]# scp hdss7-:/opt/certs/kubelet-key.pem .

2、创建配置

(1)、set-cluster

[root@hdss7- conf]# kubectl config set-cluster myk8s \
--certificate-authority=/opt/kubernetes/server/bin/cert/ca.pem \
--embed-certs=true \
--server=https://10.4.7.10:7443 \
--kubeconfig=kubelet.kubeconfig

(2)、set-credentials

[root@hdss7- conf]# kubectl config set-credentials k8s-node \
--client-certificate=/opt/kubernetes/server/bin/cert/client.pem \
--client-key=/opt/kubernetes/server/bin/cert/client-key.pem \
--embed-certs=true \
--kubeconfig=kubelet.kubeconfig

(3)、set-context

[root@hdss7- conf]# kubectl config set-context myk8s-context \
--cluster=myk8s \
--user=k8s-node \
--kubeconfig=kubelet.kubeconfig

(4)、use-context

[root@hdss7- conf]# kubectl config use-context myk8s-context --kubeconfig=kubelet.kubeconfig

(5)、查看生成的kubelet.kubeconfig

[root@hdss7- conf]# ll
kubelet.kubeconfig

(6)、k8s-node.yaml

(1)创建配置文件

[root@hdss7- conf]# vi k8s-node.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: k8s-node
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:node
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: k8s-node

(2)应用资源配置

[root@hdss7- conf]# kubectl create -f k8s-node.yaml

(3)查看集群角色和角色属性

[root@hdss7- conf]# kubectl get clusterrolebinding k8s-node
[root@hdss7- conf]# kubectl get clusterrolebinding k8s-node -o yaml

(4)拷贝kubelet.kubeconfig 到hdss7-22.host.com上

[root@hdss7- conf]# scp hdss7-:/opt/kubernetes/server/bin/conf/kubelet.kubeconfig .
4.1.4.准备pause基础镜像

hdss7-200.host.com上

1、下载pause镜像

[root@hdss7- ~]# docker pull kubernetes/pause

2、上传到docker私有仓库harbor中

(1)、给镜像打tag

[root@hdss7- ~]# docker images -a
[root@hdss7- ~]# docker tag f9d5de079539 harbor.fx.com/public/pause:latest
[root@hdss7- ~]# docker images -a

(2)、上传到harbor上

[root@hdss7- ~]# docker push harbor.fx.com/public/pause:latest
4.1.5.创建kubelet启动脚本

hdss7-21.host.com上

[root@hdss7- conf]# vi /opt/kubernetes/server/bin/kubelet.sh
#!/bin/sh
./kubelet \
--anonymous-auth=false \
--cgroup-driver systemd \
--cluster-dns 192.168.0.2 \
--cluster-domain cluster.local \
--runtime-cgroups=/systemd/system.slice \
--kubelet-cgroups=/systemd/system.slice \
--fail-swap-on="false" \
--client-ca-file ./cert/ca.pem \
--tls-cert-file ./cert/kubelet.pem \
--tls-private-key-file ./cert/kubelet-key.pem \
--hostname-override hdss7-.host.com \
--image-gc-high-threshold \
--image-gc-low-threshold \
--kubeconfig ./conf/kubelet.kubeconfig \
--log-dir /data/logs/kubernetes/kube-kubelet \
--pod-infra-container-image harbor.fx.com/public/pause:latest \
--root-dir /data/kubelet
4.1.6.授权,创建目录

hdss7-21.host.com上

[root@hdss7- conf]# chmod +x /opt/kubernetes/server/bin/kubelet.sh
[root@hdss7- conf]# mkdir -p /data/logs/kubernetes/kube-kubelet /data/kubelet
4.1.7.创建supervisor配置
[root@hdss7- conf]#  vi /etc/supervisord.d/kube-kubelet.ini
[program:kube-kubelet--]
command=/opt/kubernetes/server/bin/kubelet.sh ; the program (relative uses PATH, can take args)
numprocs= ; number of processes copies to start (def )
directory=/opt/kubernetes/server/bin ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs= ; number of secs prog must stay running (def. )
startretries= ; max # of serial start failures (default )
exitcodes=, ; 'expected' exit codes for process (default ,)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
user=root ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/kubernetes/kube-kubelet/kubelet.stdout.log ; stderr log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups= ; # of stdout logfile backups (default )
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stdout_events_enabled=false ; emit events on stdout writes (default false)
4.1.8.启动服务并检查
[root@hdss7- conf]# supervisorctl  update
[root@hdss7- conf]# supervisorctl status
4.1.9.部署所有节点

不同的地方

/opt/kubernetes/server/bin/kubelet.sh
--hostname-override
##########
/etc/supervisord.d/kube-kubelet.ini
[program:kube-kubelet--]
4.1.10.检查所有节点并给节点打上标签
[root@hdss7- bin]# kubectl get nodes
[root@hdss7- bin]# kubectl label node hdss7-.host.com node-role.kubernetes.io/master=
[root@hdss7- bin]# kubectl label node hdss7-.host.com node-role.kubernetes.io/node=
[root@hdss7- bin]# kubectl get nodes
4.2.部署kube-proxy
4.2.1.集群架构
主机名 角色 IP地址
hdss7-21.host.com kube-proxy 10.4.7.21
hdss7-22.host.com kube-proxy 10.4.7.22

部署方法以hdss7-21.host.com为例

4.2.2.签发kube-proxy证书

hdss7-200.host.com上

1、创建生成证书csr的json配置文件

[root@hdss7- certs]# vi kube-proxy-csr.json
{
"CN": "system:kube-proxy",
"key": {
"algo": "rsa",
"size":
},
"names": [
{
"C": "CN",
"ST": "beijing",
"L": "beijing",
"O": "od",
"OU": "ops"
}
]
}

2、生成kube-proxy证书文件

[root@hdss7- certs]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client kube-proxy-csr.json |cfssl-json -bare kube-proxy-client
3、检查生成的证书文件
[root@hdss7- certs]# ll
kube-proxy-client.csr
kube-proxy-client-key.pem
kube-proxy-client.pem
kube-proxy-csr.json
4.2.3.拷贝证书文件至各节点,并创建配置

hdss7-21.host.com上

1、拷贝证书文件

[root@hdss7- cert]# scp hdss7-:/opt/certs/kube-proxy-client.pem .
[root@hdss7- cert]# scp hdss7-:/opt/certs/kube-proxy-client-key.pem .

2、创建配置

(1)、set-cluster

[root@hdss7- conf]# kubectl config set-cluster myk8s \
--certificate-authority=/opt/kubernetes/server/bin/cert/ca.pem \
--embed-certs=true \
--server=https://10.4.7.10:7443 \
--kubeconfig=kube-proxy.kubeconfig

(2)、set-credentials

[root@hdss7- conf]#  kubectl config set-credentials kube-proxy \
--client-certificate=/opt/kubernetes/server/bin/cert/kube-proxy-client.pem \
--client-key=/opt/kubernetes/server/bin/cert/kube-proxy-client-key.pem \
--embed-certs=true \
--kubeconfig=kube-proxy.kubeconfig

(3)、set-context

[root@hdss7- conf]# kubectl config set-context myk8s-context \
--cluster=myk8s \
--user=kube-proxy \
--kubeconfig=kube-proxy.kubeconfig

(4)、use-context

[root@hdss7- conf]# kubectl config use-context myk8s-context --kubeconfig=kube-proxy.kubeconfig

(5)、拷贝kube-proxy.kubeconfig 到 hdss7-22.host.com的conf目录下

[root@hdss7- conf]# scp hdss7-:/opt/kubernetes/server/bin/conf/kube-proxy.kubeconfig .
4.2.4.创建kube-proxy启动脚本

hdss7-21.host.com上

1、加载ipvs模块

[root@hdss7- bin]# lsmod |grep ip_vs
[root@hdss7- bin]# vi /root/ipvs.sh
#!/bin/bash
ipvs_mods_dir="/usr/lib/modules/$(uname -r)/kernel/net/netfilter/ipvs"
for i in $(ls $ipvs_mods_dir|grep -o "^[^.]*")
do
/sbin/modinfo -F filename $i &>/dev/null
if [ $? -eq ];then
/sbin/modprobe $i
fi
done
[root@hdss7- bin]# chmod +x /root/ipvs.sh
[root@hdss7- bin]# sh /root/ipvs.sh
[root@hdss7- bin]# lsmod |grep ip_vs

2、创建启动脚本

[root@hdss7- bin]# vi /opt/kubernetes/server/bin/kube-proxy.sh
#!/bin/sh
./kube-proxy \
--cluster-cidr 172.7.0.0/ \
--hostname-override hdss7-.host.com \
--proxy-mode=ipvs \
--ipvs-scheduler=nq \
--kubeconfig ./conf/kube-proxy.kubeconfig
4.2.5.授权,创建目录
[root@hdss7- bin]# ls -l /opt/kubernetes/server/bin/conf/|grep kube-proxy
[root@hdss7- bin]# chmod +x /opt/kubernetes/server/bin/kube-proxy.sh
[root@hdss7- bin]# mkdir -p /data/logs/kubernetes/kube-proxy
4.2.6.创建supervisor配置
[root@hdss7- bin]# vi /etc/supervisord.d/kube-proxy.ini
[program:kube-proxy--]
command=/opt/kubernetes/server/bin/kube-proxy.sh ; the program (relative uses PATH, can take args)
numprocs= ; number of processes copies to start (def )
directory=/opt/kubernetes/server/bin ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs= ; number of secs prog must stay running (def. )
startretries= ; max # of serial start failures (default )
exitcodes=, ; 'expected' exit codes for process (default ,)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs= ; max num secs to wait b4 SIGKILL (default )
user=root ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/kubernetes/kube-proxy/proxy.stdout.log ; stderr log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups= ; # of stdout logfile backups (default )
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default )
stdout_events_enabled=false ; emit events on stdout writes (default false)
4.2.7.启动服务并检查
[root@hdss7- bin]# supervisorctl update
[root@hdss7- bin]# supervisorctl status
[root@hdss7- bin]# yum install ipvsadm -y
[root@hdss7- bin]# ipvsadm -Ln
[root@hdss7- bin]# kubectl get svc
4.2.8.部署所有节点

不同的地方

/opt/kubernetes/server/bin/kube-proxy.sh
--hostname-override
##########
/etc/supervisord.d/kube-proxy.ini
[program:kube-proxy--]

5.验证kubernetes集群

5.1.在任意一个节点上创建一个资源配置清单

hdss7-21.host.com上

[root@hdss7- ~]# vi /root/nginx-ds.yaml
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nginx-ds
spec:
template:
metadata:
labels:
app: nginx-ds
spec:
containers:
- name: my-nginx
image: harbor.fx.com/public/nginx:v1.7.9
ports:
- containerPort:
5.2.应用资源配置,并检查
5.2.1.hdss7-21.host.com上
[root@hdss7- bin]# kubectl create -f /root/nginx-ds.yaml
[root@hdss7- bin]# kubectl get pods
[root@hdss7- bin]# kubectl get pods -o wide
[root@hdss7- bin]# curl 172.7.21.2
5.2.2.hdss7-22.host.com上
[root@hdss7- bin]# kubectl get pods
[root@hdss7- bin]# kubectl get pods -o wide
[root@hdss7- bin]# curl 172.7.22.2
5.2.3.查看kubernetes是否搭建好
[root@hdss7- bin]# kubectl get cs
[root@hdss7- bin]# kubectl get node
[root@hdss7- bin]# kubectl get pods

返回顶部

1.二进制部署kubernetes的更多相关文章

  1. 二进制部署 Kubernetes 集群

    二进制部署 Kubernetes 集群   提供的几种Kubernetes部署方式 minikube Minikube是一个工具,可以在本地快速运行一个单点的Kubernetes,尝试Kubernet ...

  2. 5.基于二进制部署kubernetes(k8s)集群

    1 kubernetes组件 1.1 Kubernetes 集群图 官网集群架构图 1.2 组件及功能 1.2.1 控制组件(Control Plane Components) 控制组件对集群做出全局 ...

  3. K8S学习笔记之二进制部署Kubernetes v1.13.4 高可用集群

    0x00 概述 本次采用二进制文件方式部署,本文过程写成了更详细更多可选方案的ansible部署方案 https://github.com/zhangguanzhang/Kubernetes-ansi ...

  4. 二进制部署kubernetes集群(上篇)

    1.实验架构 1.1.硬件环境 准备5台2c/2g/50g虚拟机,使用10.4.7.0/24 网络 .//因后期要直接向k8s交付java服务,因此运算节点需要4c8g.不交付服务,全部2c2g足够. ...

  5. 二进制部署kubernetes

    Kubernetes二进制安装 环境准备: 主机环境:做好主机名hosts文件映射 硬件2cpu  2G内存 192.168.30.21 k8s-master 192.168.30.22 k8s-no ...

  6. 二进制部署kubernetes集群(下篇)

    1.k8S核心资源管理方法 1.1.陈述式资源管理方法 1.1.1.管理名称空间资源 1.1.1.1.查看名称空间 [root@hdss7-21 ~]# kubectl get namespace N ...

  7. ansible二进制部署kubernetes集群

    kubernetes版本1.21.5 需要的资源文件请自行到我的阿里云盘下载 https://www.aliyundrive.com/s/zVegF78ATDV 修改主机信息 #根据自己的主机信息自行 ...

  8. 二进制部署kubernetes集群_kube-apiserver提示"watch chan error: etcdserver: mvcc: required revision has been compacted'

    查看kube-apiserver状态 [root@yxz-cluster01 ~]# systemctl status kube-apiserver -l ● kube-apiserver.servi ...

  9. Centos7离线部署kubernetes 1.13集群记录

    一.说明 本篇主要参考kubernetes中文社区的一篇部署文章(CentOS 使用二进制部署 Kubernetes 1.13集群),并做了更详细的记录以备用. 二.部署环境 1.kubernetes ...

随机推荐

  1. [256个管理学理论]005.羊群效应(Herd Behavior)

    羊群效应(Herd Behavior) 来自于大洋彼岸的让你看不懂的解释: “羊群效应”,也叫“从众效应”,是个人的观念或行为由于真实的或想像的群体的影响或压力,而向与多数人相一致的方向变化的现象.表 ...

  2. [JavaWeb基础] 029.OGNL表达式介绍

    1.OGNL概述 OGNL,全称为Object-Graph Navigation Language,它是一个功能强大的表达式语言,用来获取和设置Java对象的属性,它旨在提供一个更高的更抽象的层次来对 ...

  3. win上的python

    #启用浏览器,最大化窗口 #coding = utf-8 from selenium import webdriver class MyClass(object): ''' classdocs ''' ...

  4. Android 中加载本地Html 跨域问题,http协议允许加载

    一.需求: 后台加载HTML的包时间太长,太卡,让把所有的HTML包放到前台:使用的是file://协议,有些内容和样式加载不出来,H5那边说需要用http://协议来加载: 二.处理过程: 安卓最简 ...

  5. 用java方式实现快速排序

    一.基本思想 快速排序采用分治的策略,具体如下:选择一个关键值作为基准值,找到一个元素小于比基准值小的都在左边序列(一般是无序的),比基准值大的都在右边(一般是无序的).一般选用序列第一个元素作为基准 ...

  6. Linux SCP命令远程复制文件

    从本地复制到远程 scp 本地文件 远程用户名@远程地址:远程目录(此命令回车后会要求输入密码,验证通过后会把本地文件复制到远程目录中,文件名不变) 或者 scp 本地文件 远程用户名@远程地址:远程 ...

  7. 【RT-Thread笔记】OneNet软件包的使用

    去年,RT-Thread发布了RT-Thread Studio初版RT-ThreadStudio的使用体验,经过不断更新迭代之后,来到了V1.1.0,咱也来拥抱一下新版本. 本篇笔记咱们以接入OneN ...

  8. jchdl - GSL Wire

    https://mp.weixin.qq.com/s/4w_wwwCd6iBhh0QR2wK81Q   org.jchdl.model.gsl.core.datatype.net.Wire.java ...

  9. Java实现 LeetCode 775 全局倒置与局部倒置(分析题)

    775. 全局倒置与局部倒置 数组 A 是 [0, 1, -, N - 1] 的一种排列,N 是数组 A 的长度.全局倒置指的是 i,j 满足 0 <= i < j < N 并且 A ...

  10. Java实现 LeetCode 486 预测赢家

    486. 预测赢家 给定一个表示分数的非负整数数组. 玩家1从数组任意一端拿取一个分数,随后玩家2继续从剩余数组任意一端拿取分数,然后玩家1拿,--.每次一个玩家只能拿取一个分数,分数被拿取之后不再可 ...