Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Kubernetes Cluster installation Guide: kube-apiserver component deployment

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In the kubernetes component, the master node component mainly includes: kube-apiserver,kube-controller-manager,kube-scheduler and other three components, each component has different functions and responsibilities. Here we deploy the three components on the same machine and deploy three machines respectively.

1 installation preparation 1.1 Environment variable definition # Variable parameter setting # # KUBE_NAME=kube-apiserverK8S_INSTALL_PATH=/data/apps/k8s/kubernetesK8S_BIN_PATH=$ {K8S_INSTALL_PATH} / sbinK8S_LOG_DIR=$ {K8S_INSTALL_PATH} / logsK8S_CONF_PATH=/etc/k8s/kubernetesCA_DIR=/etc/k8s/sslSOFTWARE= / root/softwareVERSION=v1.14.2PACKAGE= "kubernetes-server-$ {VERSION}-linux-amd64.tar.gz" DOWNLOAD_URL= "" https://github.com/devops-apps/download/raw/master/kubernetes/${PACKAGE}"ETCD_ENDPOIDS=https://10.10.10.22:2379, Https://10.10.10.23:2379,https://10.10.10.24:2379ETH_INTERFACE=eth2LISTEN_IP=$(ifconfig | grep-A 1 ${ETH_INTERFACE} | grep inet | awk'{print $2}') USER=k8sSERVICE_CIDR=10.254.0.0/22NODE_PORT_RANG=8400-94001.2 download and distribute kubernetes binaries

Log in to the devops machine and visit the official address of kubernetes github to download the stable realease package to this machine.

Wget $DOWNLOAD_URL-P $SOFTWARE

Distribute kubernetes packages to each master node server

Sudo ansible master_k8s_vgs-m copy-a "src=$ {SOFTWARE} / $PACKAGE dest=$ {SOFTWARE} /"-b2 install kube-apiserver component Services 2.1 install kube-apiserver binaries # 1.Check if the install directory exists.if [!-d "$K8S_BIN_PATH"]; then mkdir-p $K8S_BIN_PATHfiif [!-d "$K8S_LOG_DIR/$KUBE_NAME"] Then mkdir-p $K8S_LOG_DIR/$KUBE_NAMEfiif [!-d "$K8S_CONF_PATH"]; then mkdir-p $K8S_CONF_PATHfi### 2.Install kube-apiserver binary of kubernetes.if [!-f "$SOFTWARE/kubernetes-server-$ {VERSION}-linux-amd64.tar.gz"] Then wget $DOWNLOAD_URL-P $SOFTWARE > > / tmp/install.log 2 > & 1ficd $SOFTWARE & & tar-xzf kubernetes-server-$ {VERSION}-linux-amd64.tar.gz-C. / cp-fp kubernetes/server/bin/$KUBE_NAME $K8S_BIN_PATHln-sf $K8S_BIN_PATH/$KUBE_NAM / usr/local/binchown-R $USER:$USER $K8S_INSTALL_PATHchmod-R 755 $K8S_INSTALL_PATH2.3 Distribution kubeconfig File and Certificate Distribution Certificate cd ${CA_DIR} sudo Ansible master_k8s_vgs-m copy-a "src=ca.pem dest=$ {CA_DIR} /"-bsudo ansible master_k8s_vgs-m copy-a "src=ca-key.pem dest=$ {CA_DIR} /"-bsudo ansible master_k8s_vgs-m copy-a "src=kubernetes.pem dest=$ {CA_DIR} /"-bsudo ansible master_k8s_vgs-m copy-a "src=kubernetes-key.pem dest=$ {CA_DIR} /"-bsudo ansible master_k8s_vgs-m copy-a "src=proxy-clinet.pem dest=$ {CA_DIR} /"-b, Sudo ansible master_k8s_vgs-m copy-a "src=proxy-client-key.pem dest=$ {CA_DIR} /"-b because the components related to the master node are deployed on the same node Here all the ca root certificate public and private keys are synchronized to each master node host Proxy-client is mainly used for apiserver to collect metric server resources; 2.4 create audit policy file cat > ${K8S_CONF_PATH} / audit-policy.yaml

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report