In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The kube-proxy component is to provide endpoint services for pod applications in the cluster. When we define a svc for a pod, kube-proxy will automatically generate a mapping between pod and svc and proxy it to the cluster or host.
1 installation preparation
Special note: all operations here are performed on devops through the ansible tool. Kube-proxy needs to use kubeconfig authentication files to securely access kube-apiserver: it monitors the changes of service and endpoint in apiserver, and creates routing rules to provide service IP and load balancing functions.
1.1 Environment variable definition # Variable parameter setting # # KUBE_NAME=kube-proxyK8S_INSTALL_PATH=/data/apps/k8s/kubernetesK8S_BIN_PATH=$ {K8S_INSTALL_PATH} / sbinK8S_LOG_DIR=$ {K8S_INSTALL_PATH} / logsK8S_CONF_PATH=/etc/k8s/kubernetesKUBE_CONFIG_PATH=/etc/k8s/kubeconfigCA_DIR=/ Etc/k8s/sslSOFTWARE=/root/softwareHOSTNAME= `hostname`VERSION = v1.14.2PACKAGED KubernetesMuffle https://github.com/devops-apps/download/raw/master/kubernetes/$PACKAGEETH_INTERFACE=eth2LISTEN_IP=$(ifconfig ${VERSION}-linux-amd64.tar.gzDOWNLOAD_URL= https://github.com/devops-apps/download/raw/master/kubernetes/$PACKAGEETH_INTERFACE=eth2LISTEN_IP=$(ifconfig | grep-A 1 ${ETH_INTERFACE} | grep inet | awk'{print $2}') CLUSTER_PODS_CIDR=172.16.0.0/201.2 downloads and distributes kubernetes binaries
Visit the official address of kubernetes github to download a 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 deployment kube-proxy cluster 2.1 install kube-proxy 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_PATHfiif [!-d "$KUBE_CONFIG_PATH"]; then mkdir-p $KUBE_CONFIG_PATHfi### 2.Install kube-proxy 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 $K8Smits bindings path K8S_INSTALL_PATH2.2 ${KUBE_NAME} / usr/local/binchmod-R 755 $K8S_INSTALL_PATH2.2 Distribution kubeconfig File and Certificate File Distribution CA Root Certificate cd $CA_DIRansible worker_k8s_vgs- M copy-a "src=ca.pem dest=$CA_DIR"-b distributes kubeconfig certification documents
Kube-proxy uses the kubeconfig file connection to access the apiserver service, which provides the apiserver address, embedded CA certificate and kube-proxy server certificate, and private key:
Cd $KUBE_CONFIG_PATHansible worker_k8s_vgs-m copy-a "src= kube-proxy.kubeconfig dest=$KUBE_CONFIG_PATH"-b
Note: if you have synchronized the component kubeconfig and certificate files in the previous section, you do not have to do this here
2.3 create kube-proxy profile cat > ${K8S_CONF_PATH} / kube-proxy-config.yaml 172.16.3.3 Masq 8080 Masq 1 00-> 172.16.3.4 K8S_CONF_PATH 8080 Masq 1 00 TCP 192.168.20.40 kube-proxy 8497 rr-> 172.16.3.2 K8S_CONF_PATH 8500 Masq 100-> 172.16.3.3 Masq 8500 Masq 100-> 172.16.3.4 Masq 100 TCP 10.10.10.40 Masq 8400 rr-> 172.16.3.2 Masq 8080 Masq 10 0-> 172.16.3.3 Masq 8080 Masq 100-> 172.16.3.4 purl 8080 100 0
At this point, the whole cluster is basically deployed. For kubernetes cluster monitoring, please refer to: kubernetes Cluster installation Guide: kubernetes Cluster plug-in deployment. The kube-proxy script can be obtained here
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.