CentOSのに基づいて、1810年6月7日のバージョンがインストールされています
1、システムのアップグレードと設定
サーバー名を変更します。
hostnamectl設定ホスト名の変更名
CentOSのカーネルアップグレードパッケージ
yumの-y更新が
ヤムヤム・プラグインを-fastestmirrorインストール-y
yumをインストール-y EPELリリース
のrpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
のrpm -Uvh ます。http:// www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
のyum -y --enablerepo = elrepo-カーネルのインストールカーネルミリリットル
最新バージョンをインストールするために、デフォルトのブートカーネルを設定します
GRUB2・セットのデフォルト0
GRUB2-mkconfig -o /boot/grub2/grub.cfg
インストールツール
ヤムヤム-utilsのipvsadmののtelnetのwgetネットツールをインストール-y
設定してあるsystem.conf
猫>> /etc/systemd/system.conf << EOF
DefaultLimitMEMLOCK =無限
DefaultLimitCORE =無限
DefaultCPUAccounting = yesの
DefaultMemoryAccounting = yesの
DefaultLimitNOFILE = 1024000
DefaultLimitNPROC = 1024000
EOF
ファイアウォールとSELinuxをオフに設定
SED -iさん/ SELINUX =。* / SELINUX =無効/ G 'の/ etc / selinuxを/ configに
systemctl停止firewalld && systemctl無効firewalld
setenforce 0
閉じるスワップ
するswapoff -a &&のsysctl -w vm.swappiness = 0
VIの/ etc / fstabの
#/ DEV /マッパ/ CentOSのスワップスワップスワップデフォルト0
ulimitのは、ディスクIOを最適化するために、大きなメモリページを無効に設定
説明:SDは、デバイスに対応するサーバ名を変更します
エコー"のulimitが-shn 1024000" >> /etc/rc.localの
猫>> /etc/rc.localの<< EOF
かのテスト-f / SYS /カーネル/ MM / transparent_hugepage /有効。その後、
エコー決して> / SYS /カーネル/ MM / transparent_hugepage有効/
Fiの
場合、テスト-f / SYS /カーネル/ MM / transparent_hugepage /デフラグ。その後、
エコー決して> / SYS /カーネル/ MM / transparent_hugepage /デフラグ
Fiを
ブロック= `(/ SYS /ブロック/ -name "SDを見つける")`
の\ $ブロックのSBLOCKため
か
エコー16384> \ $のSBLOCK /キュー/ read_ahead_kb
エコー512> \ $ SBLOCK /キュー/ nr_requests
行わ
ブロック= `(見つけるの/ dev / -name "SD "
chmodの+ Xは/etc/rc.local
sysctl.confのカーネルのコンフィギュレーション設定オープンBBR
真> /etc/sysctl.confの
猫>> /etc/sysctl.confの<< EOF
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
fs.file-MAX = 2048000
fs.nr_open = 2048000
FS .quota.free_dquots = 0
vm.min_free_kbytes = 512000
vm.swappiness = 0
vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
vm.dirty_writeback_centisecs = 200
vm.dirty_expire_centisecs = 500
vm.vfs_cache_pressure = 200
vm.max_map_count = 2048000
vm.overcommit_memory = 1
vm.zone_reclaim_mode = 0
vm.panic_on_oom = 0
vm.oom_kill_allocating_task = 1
kernel.randomize_va_space = 1
kernel.sem = 5010 641280 5010 128
kernel.pid_max = 4194303
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 2621440
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4。 tcp_rmem = 1024000 8738000 1677721600
net.ipv4.tcp_wmem = 1024000 8738000 1677721600
net.ipv4.udp_mem = 1024000 8738000 1677721600
net.ipv4.tcp_mem = 1024000 8738000 1677721600
net.ipv4.route.flush = 1
net.core.wmem_default = 167772160
ネット。 core.rmem_default = 167772160
のnet.core.rmem_max = 167772160
のnet.core.wmem_max = 167772160
net.ipv4.udp_rmem_min = 167772160
net.ipv4.udp_wmem_min = 167772160
net.core.optmem_max = 2048000
net.core.netdev_max_backlog = 2048000
net.core.somaxconn = 65535
net.core.dev_weight = 64
net.core.message_cost = 5
net.core.message_burst = 10
net.core.busy_poll = 0
ネット.core.busy_read = 0
net.core.netdev_budget = 300
net.core.default_qdisc = FQ
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 2048000
net.unix.max_dgram_qlen = 2048000
net.ipv4.tcp_timestamps = 0
ネット。 ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 75
のnet.ipv4.ip_local_port_range = 1024 65535
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf。 all.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
ネット.ipv4.ip_forward = 1
net.bridge.bridge-NF-CALL-arptables = 1
net.bridge.bridge-NF-CALL-のiptables = 1
net.bridge.bridge-NF-CALL-ip6tablesを= 1
net.ipv4.conf .all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4 .conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.tcp_retrans_collapse = 1つの
ネット。 ipv4.ip_default_ttl = 64
net.ipv4.ip_dynaddr = 0
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_retries2 = 15
net.ipv4.tcp_abort_on_overflow = 0
net.ipv4.inet_peer_threshold = 65664
net.ipv4.inet_peer_minttl = 120
net.ipv4.inet_peer_maxttl = 600
net.ipv4.tcp_app_win = 31
net.ipv4.tcp_adv_win_scale = 2
net.ipv4.tcp_frto = 2
net.ipv4.tcp_low_latency = 0
net.ipv4.tcp_no_metrics_save = 0
net.ipv4.tcp_moderate_rcvbuf = 1
正味.ipv4.tcp_tso_win_divisor = 3
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_base_mss = 512
net.ipv4.tcp_workaround_signed_windows = 0
net.ipv4.tcp_challenge_ack_limit = 100
net.ipv4.tcp_limit_output_bytes = 131072
= 1つのnet.ipv4.tcp_slow_start_after_idle
ネット。 netfilter.nf_conntrack_tcp_timeout_last_ack = 10
net.ipv4.tcp_available_congestion_control = BBR立方リノ
net.ipv4.tcp_congestion_control = BBR
net.ipv4.tcp_max_ssthresh = 0
net.ipv4.tcp_thin_linear_timeouts = 0
net.ipv4.tcp_thin_dupack = 0
net.ipv4.tcp_min_tso_segs = 2
net.ipv4.conf.all.forwarding = 0
net.ipv4.conf.all.shared_media = 1
net.ipv4.conf.all .src_valid_mark = 0
net.ipv4.conf.all.medium_id = 0
net.ipv4.conf.all.bootp_relay = 0
net.ipv4.conf.all.log_martians = 0
net.ipv4.neigh.default.gc_thresh1 = 80000
ネット。 ipv4.neigh.default.gc_thresh2 = 90000
net.ipv4.neigh.default.gc_thresh3 = 100000
net.ipv4.conf.all.tag = 0
EOF
/ sbinに/ sysctlを-p
はlsmod | grepのBBR ##查看BBR是否加载
設定してあるlimits.conf
cat >> /etc/security/limits.conf << EOF
* soft nproc 1024000
* hard nproc 1024000
* soft nofile 1024000
* hard nofile 1024000
* soft core 1024000
* hard core 1024000
######big mem ########
#* hard memlock unlimited
#* soft memlock unlimited
EOF
20-nproc.confを設定します。
しかし、-iさん/ 4096/1024000 / /etc/security/limits.d/20-nproc.conf
セット・ジャーナル・ログのサイズとストレージ・パス
エコーSystemMaxUse = 600M >>は/ etc / systemdに/ journald.conf
ます。mkdir -pは/ var / log /ジャーナル
のchownルート:システムD-ジャーナルは/ var / log /ジャーナル
chmodの2755は/ var / log /ジャーナル
にsystemd-journaldを再起動しsystemctl
閉じるNetworkManagerの
NetworkManager.serviceを無効systemctl
NetworkManager.service停止systemctl
サービスネットワークの再起動の
上のchkconfigのネットワークを
プロファイルの変更
猫は>> / etc / profileをは<< EOF
のulimit -d無制限
のulimit -m無制限
のulimitを無制限-s
のulimit -v無制限
無制限-tのulimit
のulimit -c無制限
のulimit -l無制限
EOFを
。/ etc / profileをの
リブート
2 K8S-動作環境準備
2.1、ノードの後のノードに分散コンパイラLXCSF
コンパイルツールをダウンロード
yum install -y git automake libtool fuse-devel ansible
コンパイルLXCSF
gitのクローンgitの://github.com/lxc/lxcfsの
CD lxcfs /
./bootstrap.sh
./configureを
作り
ます。mkdir ../binlxfs/lib/lxcfs
CP -pdr lxcfs ../binlxfs
CP -pdr .LIBS / iblxcfsを。そう../binlxfs/lib/lxcfs
CP -pdr liblxcfs.la ../binlxfs/lib/lxcfs
作成LXCFSは、サービスを開始します
cd ../binlxfs
cat << EOF | tee lxcfs.service
[Unit]
Description=FUSE filesystem for LXC
ConditionVirtualization=!container
Before=lxc.service
Documentation=man:lxcfs(1)
[Service]
ExecStart=/usr/local/bin/lxcfs /var/lib/lxcfs/
KillMode=process
Restart=on-failure
ExecStopPost=-/bin/fusermount -u /var/lib/lxcfs
Delegate=yes
[Install]
WantedBy=multi-user.target
EOF
説明:lxcfs.serviceすべてのノードのノード/usr/lib/systemd/system/lxcfs.serviceに配布してください
lxcfs binlxfsフォルダは/ usr / local / bin / lxcfsに配布します
/ usr / local / libに配布さbinlxfs / libに
作成は/ var / libに/ lxcfs /ディレクトリます。mkdir -pの/ var / libに/ lxcfs /
すべてのノードのノード構成のブートlxcfs
systemctl daemon-reload && systemctl start lxcfs && systemctl enable lxcfs
2.2インストールと設定CFSSL
yumを行くインストール
〜/ .bash_profileのVI
GOBIN = /ルート/行く/ binに/
$ GOBINは:$ HOME / binパス= $ PATHの
輸出PATHが
-uがgithub.com/cloudflare/cfssl/cmd/cfssl取りに行く
行くのget -u github.com/cloudflare/cfssl/cmd/cfssljson
使用後は、クラスタの状態を表示すると2.3クライアントがインストールさkubectl
wgetのhttps://dl.k8s.io/v1.14.0/kubernetes-client-linux-amd64.tar.gz
タール-xzvf kubernetes-クライアントのlinux-amd64.tar.gz
MV kubernetes /クライアント/ binに/ kubectlは/ usr / local / binに/
RM -rf kubernetes *
Baiduのネットワークディスクのダウンロード
リンク:https://pan.baidu.com/s/1BvV1zVMG-q9Bx1nZZI_B2Q抽出コード:kr6q
次へ:etcdクラスタKubernetes v1.14.0の展開に基づいて展開するKubernetesの生産設備