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

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

kubernetes集群安裝指南:客戶端安裝及各組件認(rèn)證文件創(chuàng)建-創(chuàng)新互聯(lián)

大多情況,證書用于服務(wù)安全訪問(即https訪問)所需要,在kubernetes集群中,如果關(guān)閉了匿名訪問,開啟了集群HTTPS訪問以及TLS雙向認(rèn)證;如:worker節(jié)點(diǎn)組件HTTPS訪問apiserver服務(wù)時(shí),Apiserver還需要驗(yàn)證客戶端是否合法,此時(shí)就需要為worker節(jié)點(diǎn)上的組件生成kubeconfig認(rèn)證文件用于連接apiserver。

我們一直強(qiáng)調(diào)成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站對(duì)于企業(yè)的重要性,如果您也覺得重要,那么就需要我們慎重對(duì)待,選擇一個(gè)安全靠譜的網(wǎng)站建設(shè)公司,企業(yè)網(wǎng)站我們建議是要么不做,要么就做好,讓網(wǎng)站能真正成為企業(yè)發(fā)展過程中的有力推手。專業(yè)網(wǎng)絡(luò)公司不一定是大公司,成都創(chuàng)新互聯(lián)公司作為專業(yè)的網(wǎng)絡(luò)公司選擇我們就是放心。

1. 基本設(shè)置

1.1 變量設(shè)置
PACKAGE=kubernetes-server-v1.12.0-linux-amd64.tar.gz
K8S_DOWNLOAD_URL=https://github.com/devops-apps/download/raw/master/kubernetes/$PACKAGE
K8S_CONF_PATH=/etc/k8s/kubernetes
K8S_KUBECONFIG_PATH=/etc/k8s/kubeconfig
KUBE_APISERVER=https://dev-kube-api.mo9.com
BOOTSTRAP_TOKEN=$(head -c 16 /dev/urandom | od -An -t x | tr -d ' ')
1.2 kubectl、kubens工具集安裝
sudo wget $K8S_DOWNLOAD_URL -P /root/software
cd $SOFTWARE 
tar -xzfkubernetes-server-v1.12.0-linux-amd64.tar.gz -C ./
cp -fp kubernetes/server/bin/{kubectl,kubens} /usr/local/sbin
1.3 創(chuàng)建認(rèn)證文件存放目錄
if [ ! -d "$K8S_CONF_PATH" ]; then
     mkdir -p $K8S_CONF_PATH
fi

if [ ! -d "$K8S_KUBECONFIG_PATH" ]; then
     mkdir -p $K8S_KUBECONFIG_PATH
fi

2. 創(chuàng)建 TLS Bootstrapping Token

cat > ${K8S_CONF_PATH}/token.csv <
  • bootstrapping token文件主要用于為apiserver開啟tocken認(rèn)證而創(chuàng)建,如果沒有開啟apiserver token認(rèn)證可以不用創(chuàng)建此文件;

3 kubeconfig文件創(chuàng)建

3.1 創(chuàng)建kube-controller-manager kubeconfig文件
kubectl config set-cluster kubernetes \
  --certificate-authority=${CA_DIR}/ca.pem \
  --embed-certs=true \
  --server=${KUBE_APISERVER} \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-controller-manager.kubeconfig

kubectl config set-credentials system:kube-controller-manager \
  --client-certificate=${CA_DIR}/kube-controller-manager.pem \
  --client-key=${CA_DIR}/kube-controller-manager-key.pem \
  --embed-certs=true \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-controller-manager.kubeconfig

kubectl config set-context system:kube-controller-manager \
  --cluster=kubernetes \
  --user=system:kube-controller-manager \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-controller-manager.kubeconfig

kubectl config use-context system:kube-controller-manager \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-controller-manager.kubeconfig
3.2 創(chuàng)建kube-shceduler kubeconfig文件
kubectl config set-cluster kubernetes \
  --certificate-authority=${CA_DIR}/ca.pem \
  --embed-certs=true \
  --server=${KUBE_APISERVER} \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-scheduler.kubeconfig

kubectl config set-credentials system:kube-scheduler \
  --client-certificate=${CA_DIR}/kube-scheduler.pem \
  --client-key=${CA_DIR}/kube-scheduler-key.pem \
  --embed-certs=true \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-scheduler.kubeconfig

kubectl config set-context system:kube-scheduler \
  --cluster=kubernetes \
  --user=system:kube-scheduler \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-scheduler.kubeconfig

kubectl config use-context system:kube-scheduler \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-scheduler.kubeconfig
3.3 創(chuàng)建kubelet bootstrapping kubeconfig文件
kubectl config set-cluster kubernetes \
  --certificate-authority=${CA_DIR}/ca.pem \
  --embed-certs=true \
  --server=${KUBE_APISERVER} \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/bootstrap.kubeconfig

kubectl config set-credentials kubelet-bootstrap \
  --token=${BOOTSTRAP_TOKEN} \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/bootstrap.kubeconfig

kubectl config set-context default \
  --cluster=kubernetes \
  --user=kubelet-bootstrap \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/bootstrap.kubeconfig

kubectl config use-context default \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/bootstrap.kubeconfig
  • bootstrapping文件主要用于apiserver給kubelet證書做自動(dòng)輪轉(zhuǎn),使用該文件,apiserver會(huì)自動(dòng)給kubelet頒發(fā)服務(wù)端證書以及證書密鑰,從而不必為kubelet證書
3.4 創(chuàng)建kube-proxy kubeconfig文件
kubectl config set-cluster kubernetes \
  --certificate-authority=${CA_DIR}/ca.pem \
  --embed-certs=true \
  --server=${KUBE_APISERVER} \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-proxy.kubeconfig

kubectl config set-credentials kube-proxy \
  --client-certificate=${CA_DIR}/kube-proxy.pem \
  --client-key=${CA_DIR}/kube-proxy-key.pem \
  --embed-certs=true \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-proxy.kubeconfig

kubectl config set-context default \
  --cluster=kubernetes \
  --user=kube-proxy \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-proxy.kubeconfig

kubectl config use-context default \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kube-proxy.kubeconfig
3.5 創(chuàng)建kubectl kubeconfig文件
kubectl config set-cluster kubernetes \
  --certificate-authority=${CA_DIR}/ca.pem \
  --embed-certs=true \
  --server=${KUBE_APISERVER} \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kubectl.kubeconfig

kubectl config set-credentials admin \
  --client-certificate=${CA_DIR}/admin.pem \
  --client-key=${CA_DIR}/admin-key.pem \
  --embed-certs=true \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kubectl.kubeconfig

kubectl config set-context kubernetes \
  --cluster=kubernetes \
  --user=admin \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kubectl.kubeconfig

kubectl config use-context kubernetes \
  --kubeconfig=${K8S_KUBECONFIG_PATH}/kubectl.kubeconfig
  • --certificate-authority:驗(yàn)證 kube-apiserver 證書的根證書;
  • --client-certificate、--client-key:剛生成的 admin 證書和私鑰,連接 kube-apiserver 時(shí)使用;
  • --embed-certs=true:將 ca.pem 和 admin.pem 證書內(nèi)容嵌入到生成的 kubectl.kubeconfig 文件中(不加時(shí),寫入的是證書文件路徑);

備注:kubeconfig文件是用于安全連接apiserver服務(wù)的認(rèn)證文件。

4 同步token文件及kubeconfig文件到相應(yīng)的節(jié)點(diǎn)

  • master節(jié)點(diǎn):

    cd $K8S_KUBECONFIG_PATH
    ansible master_k8s_vgs -m copy -a \
    " src=kube-controller-manager.kubeconfig dest=$K8S_KUBECONFIG_PATH/ " -b
    ansible master_k8s_vgs -m copy -a \
    " src=kube-scheduler.kubeconfig dest=$K8S_KUBECONFIG_PATH/ " -b
  • worker節(jié)點(diǎn)
    cd $K8S_KUBECONFIG_PATH
    ansible worker_k8s_vgs -m copy -a \
    " src=bootstrap.kubeconfig dest=$K8S_KUBECONFIG_PATH/ " -b
    ansible worker_k8s_vgs -m copy -a \
    " src=kube-proxy.kubeconfig dest=$K8S_KUBECONFIG_PATH/ " -b
  • kubeconfig文件主要用于各組件在通過https訪問apiserver時(shí)所需要的認(rèn)證的文件,該文件包括對(duì)應(yīng)組件的服務(wù)端證書、證書私鑰、ca根證書以及apiserver的訪問地址

創(chuàng)建完kubernetes集群組件相關(guān)認(rèn)證文件后,接下來正式部署kubernetes集群相關(guān)組件etcd集群,請(qǐng)參考:kubernetes集群安裝指南:etcd集群部署

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。


文章標(biāo)題:kubernetes集群安裝指南:客戶端安裝及各組件認(rèn)證文件創(chuàng)建-創(chuàng)新互聯(lián)
文章轉(zhuǎn)載:http://weahome.cn/article/djisdh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部