#构建
docker build -t imagename .
mkdir -p /opt/k8s/work/yaml
cd /opt//k8s/work/yaml
cat >/opt/k8s/work/yaml/kube-ha-proxy.yaml <<EOF
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: kube-apiserver-ha-proxy
tier: control-plane
annotations:
prometheus.io/port: "8404"
prometheus.io/scrape: "true"
name: kube-apiserver-ha-proxy
namespace: kube-system
spec:
containers:
- args:
- "CP_HOSTS=192.168.2.175,192.168.2.176,192.168.2.177"
image: docker.io/juestnow/nginx-proxy:1.21.0
imagePullPolicy: IfNotPresent
name: kube-apiserver-ha-proxy
env:
- name: CPU_NUM
value: "4"
- name: BACKEND_PORT
value: "5443"
- name: HOST_PORT
value: "6443"
- name: CP_HOSTS
value: "192.168.2.175,192.168.2.176,192.168.2.177"
hostNetwork: true
priorityClassName: system-cluster-critical
status: {}
EOF
参数说明:
已有镜像:
分发kube-ha-proxy.yaml 到所有节点
cd /opt/k8s/work/yaml/
# server 节点
scp kube-ha-proxy.yaml root@192.168.2.175:/apps/work/kubernetes/manifests/
scp kube-ha-proxy.yaml root@192.168.2.176:/apps/work/kubernetes/manifests/
scp kube-ha-proxy.yaml root@192.168.2.177:/apps/work/kubernetes/manifests/
# node 节点
scp kube-ha-proxy.yaml root@192.168.2.187:/apps/work/kubernetes/manifests/
scp kube-ha-proxy.yaml root@192.168.2.185:/apps/work/kubernetes/manifests/
scp kube-ha-proxy.yaml root@192.168.3.62:/apps/work/kubernetes/manifests/
scp kube-ha-proxy.yaml root@192.168.3.70:/apps/work/kubernetes/manifests/
期待下次的分享,别忘了三连支持博主呀~
我是 念舒_C.ying ,期待你的关注~💪💪💪
附专栏链接
【云原生 · Kubernetes】kubernetes v1.23.3 二进制部署(三)
【云原生 · Kubernetes】kubernetes v1.23.3 二进制部署(二)
【云原生 · Kubernetes】kubernetes v1.23.3 二进制部署(一)
【云原生 · Kubernetes】基础组件、Pod、Etcd的相关问题
【云原生 · Kubernetes】Jenkins+Gitlab+Rancher+Docker 实现自动构建镜像的 CI 平台(一)
【云原生 · Kubernetes】Kubernetes 编排部署GPMall(一)
【云原生 · Kubernetes】Kubernetes容器云平台部署与运维
【云原生 · Kubernetes】部署博客系统
【云原生 · Kubernetes】部署Kubernetes集群
【云原生 · Kubernetes】Kubernetes基础环境搭建