91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

K8S單master部署一:環境規劃、ETCD部署

發布時間:2020-08-10 12:52:22 來源:網絡 閱讀:198 作者:qq5d47f509174fe 欄目:云計算

實驗環境規劃


概述

使用VMwork虛擬機部署單master雙node的小型集群,并且在master和node上都安裝etcd來實現etcd集群。

軟件采用版本

軟件名稱 版本
Linux系統 Linux version 4.8.5
Kubernetes 1.9
Docker Docker version 19.03.5
Etcd v3.3.10

服務器角色分配

角色 地址 安裝組件
master 192.168.142.220 kube-apiserver kube-controller-manager kube-scheduler etcd
node1 192.168.142.136 kubelet kube-proxy docker flannel etcd
node2 192.168.142.132 kubelet kube-proxy docker flannel etcd

前期注意

所有實驗虛擬機均已關閉selinux核心防護功能

建立工作目錄用于存放二進制軟件包

[root@master ~]# cd /
[root@master /]# mkdir k8s

安裝ETCD數據庫(三節點備份)

master端方面


下載ca證書創建、管理工具cfssl

[root@master k8s]# curl -L https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -o /usr/local/bin/cfssl
[root@master k8s]# curl -L https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -o /usr/local/bin/cfssljson
[root@master k8s]# curl -L https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64 -o /usr/local/bin/cfssl-certinfo
[root@master k8s]# chmod +x /usr/local/bin/cfssl /usr/local/bin/cfssljson /usr/local/bin/cfssl-certinfo

生成ca證書

//定義ca證書,生成ca證書配置文件
[root@master k8s]# cat > ca-config.json <<EOF
{
  "signing": {
    "default": {
      "expiry": "87600h"
    },
    "profiles": {
      "www": {
         "expiry": "87600h",
         "usages": [
            "signing",
            "key encipherment",
            "server auth",
            "client auth"
        ]
      }
    }
  }
}
EOF

//生成證書簽名文件
[root@master k8s]# cat > ca-csr.json <<EOF
{
    "CN": "etcd CA",
    "key": {
        "algo": "rsa",
        "size": 2048
    },
    "names": [
        {
            "C": "CN",
            "L": "Beijing",
            "ST": "Beijing"
        }
    ]
}
EOF

//生成ca證書,ca.pem、ca-key.pem
[root@master k8s]# cfssl gencert -initca ca-csr.json | cfssljson -bare ca -

[root@master k8s]# ls
ca-config.json  ca-csr.json  ca.pem   ca.csr     ca-key.pem   
“ca.pem”         //ca證書文件
“ca-key.pem”         //ca密鑰證書文件

生成etcd各節點之間通信證書

(注意IP地址的變化)

//生成etcd節點之間的通信驗證簽名
//節點地址必須要更改
[root@master k8s]# cat > server-csr.json <<EOF
{
    "CN": "etcd",
    "hosts": [
    "192.168.142.220",
    "192.168.142.136",
    "192.168.142.132"
    ],
    "key": {
        "algo": "rsa",
        "size": 2048
    },
    "names": [
        {
            "C": "CN",
            "L": "BeiJing",
            "ST": "BeiJing"
        }
    ]
}
EOF

//生成ETCD通信證書,用于etcd之間通信驗證
[root@master k8s]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=www server-csr.json | cfssljson -bare server

[root@master k8s]# ls
ca-config.json  ca-csr.json  ca.pem        server.csr       server-key.pem
ca.csr          ca-key.pem   etcd-cert.sh  server-csr.json  server.pem
“server.pem”&“server-key.pem”      //etcd之間通信的驗證證書

配置etcd二進制文件包

//解壓安裝etcd
[root@master k8s]# tar zxf etcd-v3.3.10-linux-amd64.tar.gz

//建立存放etcd配置文件、命令、證書的目錄
[root@master k8s]# mkdir -p /opt/etcd/{cfg,bin,ssl}
[root@master k8s]# ls /opt/etcd/
bin  cfg  ssl

//將etcd中的文件分門別類存放
[root@master k8s]# mv etcd-v3.3.10-linux-amd64/etcd /opt/etcd/bin/
[root@master k8s]# mv etcd-v3.3.10-linux-amd64/etcdctl /opt/etcd/bin/
[root@master k8s]# cp -p *.pem /opt/etcd/ssl/

//etcd命令文件
[root@master k8s]# ls /opt/etcd/bin/
etcd  etcdctl

//etcd證書
[root@master k8s]# ls /opt/etcd/ssl/
ca-key.pem  ca.pem  server-key.pem  server.pem

建立etcd配置文件

[root@master k8s]# cat <<EOF >/opt/etcd/cfg/etcd
//[Member]
ETCD_NAME="etcd01"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.142.220:2380"
ETCD_LISTEN_CLIENT_URLS="https://192.168.142.220:2379"

//[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.142.220:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.142.220:2379"
ETCD_INITIAL_CLUSTER="etcd01=https://192.168.142.220:2380,etcd02=https://192.168.142.136:2380,etcd03=https://192.168.142.132:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
EOF

建立etcd啟動腳本

[root@master k8s]# cat <<EOF >/usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
EnvironmentFile=/opt/etcd/cfg/etcd
ExecStart=/opt/etcd/bin/etcd \
--name=etcd01 \
--data-dir=\${ETCD_DATA_DIR} \
--listen-peer-urls=\${ETCD_LISTEN_PEER_URLS} \
--listen-client-urls=\${ETCD_LISTEN_CLIENT_URLS},http://127.0.0.1:2379 \
--advertise-client-urls=\${ETCD_ADVERTISE_CLIENT_URLS} \
--initial-advertise-peer-urls=\${ETCD_INITIAL_ADVERTISE_PEER_URLS} \
--initial-cluster=\${ETCD_INITIAL_CLUSTER} \
--initial-cluster-token=\${ETCD_INITIAL_CLUSTER_TOKEN} \
--initial-cluster-state=new \
--cert-file=/opt/etcd/ssl/server.pem \
--key-file=/opt/etcd/ssl/server-key.pem \
--peer-cert-file=/opt/etcd/ssl/server.pem \
--peer-key-file=/opt/etcd/ssl/server-key.pem \
--trusted-ca-file=/opt/etcd/ssl/ca.pem \
--peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOF

推送證書、配置文件、啟動腳本至node節點上

//將證書、配置文件推送至其它節點
[root@master ~]# scp -r /opt/etcd/ root@192.168.142.136:/opt/
[root@master ~]# scp -r /opt/etcd/ root@192.168.142.132:/opt/

//推送啟動腳本
[root@master ~]# scp /usr/lib/systemd/system/etcd.service root@192.168.142.136:/usr/lib/systemd/system/
[root@master ~]# scp /usr/lib/systemd/system/etcd.service root@192.168.142.132:/usr/lib/systemd/system/

node端方面


更改各node節點收到的配置文件

node1

[root@node1 etcd]# vim /opt/etcd/cfg/etcd
//[Member]
ETCD_NAME="etcd02"                      //節點名稱
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.142.136:2380"               //節點地址
ETCD_LISTEN_CLIENT_URLS="https://192.168.142.136:2379"               //節點地址

//[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.142.136:2380"               //節點地址
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.142.136:2379"               //節點地址

node 2

[root@node2 ~]# vim /opt/etcd/cfg/etcd
//[Member]
ETCD_NAME="etcd03"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.142.132:2380"                      //節點名稱
ETCD_LISTEN_CLIENT_URLS="https://192.168.142.132:2379"                      //節點名稱

//[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.142.132:2380"                      //節點名稱
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.142.132:2379"                      //節點名稱

所有節點!!!!

開啟服務

//各節點關防火墻
[root@node1 etcd]# systemctl stop firewalld.service
[root@node1 etcd]# setenforce 0
[root@node1 etcd]# systemctl disable firewalld.service

//開啟etcd服務
[root@node1 etcd]# systemctl start etcd
[root@node1 etcd]# systemctl enable etcd

群集健康檢查,查看群集成員

//群集各節點健康檢查
[root@master ~]# /opt/etcd/bin/etcdctl --ca-file=/opt/etcd/ssl/ca.pem \
--cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem \
--endpoints="https://192.168.142.220:2379,https://192.168.142.136:2379,https://192.168.142.132:2379" \
cluster-health

//查看etcd群集成員
[root@master ~]# /opt/etcd/bin/etcdctl --ca-file=/opt/etcd/ssl/ca.pem \
--cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem \
--endpoints="https://192.168.142.220:2379,https://192.168.142.136:2379,https://192.168.142.132:2379" member list

未完待續~~~

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

衡山县| 陵川县| 黎川县| 永宁县| 利津县| 石首市| 琼海市| 陆丰市| 静宁县| 台前县| 新干县| 金溪县| 安顺市| 保康县| 青河县| 崇仁县| 洛浦县| 喀喇沁旗| 云阳县| 闽清县| 朝阳区| 霞浦县| 昌黎县| 安阳县| 宜宾市| 永州市| 桓台县| 岳阳县| 德兴市| 会同县| 博爱县| 扬州市| 调兵山市| 法库县| 离岛区| 尉犁县| 陕西省| 措美县| 永康市| 无极县| 梁平县|