二进制部署kubernetes v1.30.2集群 八、安装k8s其他组件
安装k8s其他组件(仅在k8s-master01节点操作)
安装网络插件cilium
一、安装helm
cd /data/src wget https://get.helm.sh/helm-v3.17.3-linux-amd64.tar.gz
tar zxf helm-v3.17.3-linux-amd64.tar.gz
cp linux-amd64/helm /usr/local/bin/
二、安装cilium
1、添加cilium仓库
helm repo add cilium https://helm.cilium.io
2、拉取cilium并解压
helm pull cilium/cilium
tar xf cilium-1.17.3.tgz
3、修改镜像源地址和分配给POD的IP地址段
sed -i "s#quay.io/#quay.m.daocloud.io/#g" cilium/values.yaml sed -i 's/\(^\s*clusterPoolIPv4PodCIDRList:\s*\).*/\1\[\"172.16.0.0\/16\"\]/' cilium/values.yaml
4、安装cilium
helm install cilium ./cilium/ -n kube-system
安装CoreDNS
1、添加coredns仓库
helm repo add coredns https://coredns.github.io/helm
2、拉取coredns并解压
helm pull coredns/coredns
tar xf coredns-1.42.1.tgz
3、新增ClusterIP配置,ClusterIP必须要在service-cluster-ip-range范围内。
vim coredns/values.yaml

4、修改镜像源地址
sed -i "s#registry.k8s.io/#k8s.m.daocloud.io/#g" coredns/values.yaml
5、安装coredns
helm install coredns ./coredns/ -n kube-system
安装Metrics
1、下载官方部署清单
wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
2、修改配置
vim components.yaml --- # 1、修改args的参数,修改为以下配置 - args: - --cert-dir=/tmp
- --secure-port=10250 - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname - --kubelet-use-node-status-port - --metric-resolution=15s - --kubelet-insecure-tls - --requestheader-client-ca-file=/data/k8s/ssl/front-proxy-ca.pem - --requestheader-username-headers=X-Remote-User - --requestheader-group-headers=X-Remote-Group - --requestheader-extra-headers-prefix=X-Remote-Extra- # 2、修改挂载信息 volumeMounts: - mountPath: /tmp name: tmp-dir - name: ca-file mountPath: /data/k8s/ssl # 3、修改数据卷信息 volumes: - emptyDir: {} name: tmp-dir - name: ca-file hostPath: path: /data/k8s/ssl ---
3、修改镜像源地址
sed -i "s#registry.k8s.io/#k8s.m.daocloud.io/#g" components.yaml
4、部署Metrics
kubectl apply -f components.yaml
安装ingress-controller
使用helm安装traefik,要求 Kubernetes 1.22+ 、Helm version 3.9+,如果低版本可以参考官方其他安装方式:https://doc.traefik.io/traefik/getting-started/quick-start-with-kubernetes/
helm repo add traefik https://traefik.github.io/charts
helm repo update
helm install traefik traefik/traefik --set deployment.replicas=2 --set providers.kubernetesCRD.allowCrossNamespace=true -n kube-system

浙公网安备 33010602011771号