{"id":694,"date":"2022-06-21T12:09:23","date_gmt":"2022-06-21T04:09:23","guid":{"rendered":"https:\/\/www.luyouli.com\/?p=694"},"modified":"2022-06-21T12:09:23","modified_gmt":"2022-06-21T04:09:23","slug":"%e5%9f%ba%e4%ba%8ekube-vip-0-4-4%e6%90%ad%e5%bb%babgp%e8%b4%9f%e8%bd%bd%e9%9b%86%e7%be%a4","status":"publish","type":"post","link":"https:\/\/www.luyouli.com\/?p=694","title":{"rendered":"\u57fa\u4e8ekube-vip 0.4.4\u642d\u5efaBGP\u8d1f\u8f7d\u96c6\u7fa4"},"content":{"rendered":"\n<p>\u73af\u5883\uff1a<\/p>\n\n\n\n<p>kubernetes\uff1av1.23.6<\/p>\n\n\n\n<p>containerd\uff1a1.6.4<\/p>\n\n\n\n<p>10.10.1.1 master01<\/p>\n\n\n\n<p>10.10.1.2 master02<\/p>\n\n\n\n<p>10.10.1.3 master03<\/p>\n\n\n\n<p>10.10.1.4 node04<\/p>\n\n\n\n<p>10.10.1.5 node05<\/p>\n\n\n\n<p>10.10.1.6 node06<\/p>\n\n\n\n<p>10.10.1.100 kubernetes-VIP<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u524d\u63d0\u6761\u4ef6\uff1a<\/p>\n\n\n\n<p>\u5728\u6240\u6709\u8282\u70b9\u4e0a\u5b89\u88c5\u5b8ckubernetes\u548ccontainerd<\/p>\n\n\n\n<p>\u7531\u4e8eBGP\u9700\u8981\u8d70\u4e09\u5c42\u4ea4\u6362\uff0c\u6240\u4ee5\u5fc5\u987b\u6709\u4e09\u5c42\u4ea4\u6362\u673a<\/p>\n\n\n\n<p>\u5c06\u4e0a\u8ff0\u6240\u6709\u7684\u8282\u70b9\u5199\u5165\u4e86hosts\u6587\u4ef6\u5185<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5728master01\u4e0a\u9762\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p>mkdir -p \/etc\/kubernetes\/manifests\/ # \u521b\u5efa\u76ee\u5f55<\/p>\n\n\n\n<p>export VIP=10.10.1.100 # \u8bbe\u7f6evip\u5730\u5740<\/p>\n\n\n\n<p>export INTERFACE=lo # \u8bbe\u7f6e\u7f51\u5361\uff0c\u5c06IP\u7ed1\u5b9a\u5728lo\u4e0a\uff0c\u53ef\u4ee5\u907f\u514d\u5f88\u591a\u9ebb\u70e6<\/p>\n\n\n\n<p>ctr image pull ghcr.io\/kube-vip\/kube-vip:v0.4.4 \u6216\u8005 ctr image pull docker.io\/plndr\/kube-vip:v0.4.4 # \u4e0b\u8f7d\u955c\u50cf<\/p>\n\n\n\n<p>ctr run &#8211;rm &#8211;net-host docker.io\/plndr\/kube-vip:v0.4.4 vip \/kube-vip manifest pod &#8211;interface $INTERFACE &#8211;vip $VIP &#8211;controlplane &#8211;services &#8211;bgp &#8211;localAS 65000 &#8211;bgpRouterID 10.10.1.1 &#8211;bgppeers 10.10.1.2:65000::false,10.10.1.3:65000::false | tee \/etc\/kubernetes\/manifests\/kube-vip.yaml # \u751f\u6210yaml\u6587\u4ef6<\/p>\n\n\n\n<p>&#8211;bgp \u542f\u7528 BGP \u5bf9\u7b49\u4e92\u8fde<\/p>\n\n\n\n<p>&#8211;localAS \u5bf9\u7b49\u7684AS\uff0c\u9ed8\u8ba4\u662f65000\uff0c\u5177\u4f53\u8fd8\u8981\u6839\u636e\u4ea4\u6362\u673a\u6765\u8c03\u6574<\/p>\n\n\n\n<p>&#8211;bgpRouterID \u672c\u5730\u8282\u70b9IP<\/p>\n\n\n\n<p>&#8211;bgppeers BGP \u5bf9\u7b49\u4f53\u5217\u8868\uff0c\u4e00\u822c\u4e3a &lt;address:AS:password:multihop&gt;<\/p>\n\n\n\n<p>kubeadm init &#8211;image-repository=registry.aliyuncs.com\/google_containers &#8211;kubernetes-version=v1.23.6 &#8211;apiserver-advertise-address=10.10.1.1 &#8211;cri-socket=\/run\/containerd\/containerd.sock &#8211;pod-network-cidr=10.244.0.0\/16 &#8211;control-plane-endpoint=kubernetes-VIP:6443 &#8211;upload-certs # \u6267\u884c\u521d\u59cb\u5316<\/p>\n\n\n\n<p>&#8211;control-plane-endpoint \u6307\u540dVIP\u5730\u5740<\/p>\n\n\n\n<p>\u521d\u59cb\u5316\u64cd\u4f5c\u4f1a\u751f\u6210\u4e24\u4e2ajoin\u547d\u4ee4\uff0c\u4e0a\u9762\u90a3\u4e2a\u7ed9master\u4f7f\u7528<\/p>\n\n\n\n<p>kubeadm join kubernetes-VIP:6443 &#8211;token ******************** \\<\/p>\n\n\n\n<p>&#8211;discovery-token-ca-cert-hash sha256:************************* \\<\/p>\n\n\n\n<p>&#8211;control-plane &#8211;certificate-key ***************************<\/p>\n\n\n\n<p>kubeadm join kubernetes-VIP:6443 &#8211;token *********************** \\<\/p>\n\n\n\n<p>&#8211;discovery-token-ca-cert-hash sha256:********************************<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5728master02\u548c03\u4e0a\u9762\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p>kubeadm join kubernetes-VIP:6443 &#8211;control-plane # \u6267\u884cjoin\u547d\u4ee4<\/p>\n\n\n\n<p>ctr run &#8211;rm &#8211;net-host docker.io\/plndr\/kube-vip:v0.4.4 vip \/kube-vip manifest pod &#8211;interface $INTERFACE &#8211;vip $VIP &#8211;controlplane &#8211;services &#8211;bgp &#8211;localAS 65000 &#8211;bgpRouterID 10.10.1.2 &#8211;bgppeers 10.10.1.1:65000::false,10.10.1.3:65000::false | tee \/etc\/kubernetes\/manifests\/kube-vip.yaml<\/p>\n\n\n\n<p>ctr run &#8211;rm &#8211;net-host docker.io\/plndr\/kube-vip:v0.4.4 vip \/kube-vip manifest pod &#8211;interface $INTERFACE &#8211;vip $VIP &#8211;controlplane &#8211;services &#8211;bgp &#8211;localAS 65000 &#8211;bgpRouterID 10.10.1.3 &#8211;bgppeers 10.10.1.1:65000::false,10.10.1.2:65000::false | tee \/etc\/kubernetes\/manifests\/kube-vip.yaml<\/p>\n\n\n\n<p>\u7531\u4e8e\u6587\u4ef6\u5728\/etc\/kubernetes\/manifests\u5185\uff0c\u6240\u4ee5\u4f1a\u81ea\u52a8\u521b\u5efakube-vip\u7684pod<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5728\u4e09\u4e2anode\u8282\u70b9\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p>kubeadm join kubernetes-VIP:6443 # \u6267\u884cjoin\u547d\u4ee4<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5728master01\u4e0a\u9762\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p>kubectl apply -f calico.yaml # \u90e8\u7f72calico<\/p>\n\n\n\n<p>kubectl get pods -A -o wide &amp;&amp; kubectl get nodes -o wide # \u67e5\u770b\u6240\u6709\u7684node\u548cpod<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u6d4b\u8bd5\uff1a<\/p>\n\n\n\n<p>\u968f\u673a\u5173\u95ed\u67d0\u4e00\u4e2amaster\uff0c\u518d\u4f7f\u7528kubectl\u547d\u4ee4\u4e00\u5207\u6b63\u5e38<\/p>\n\n\n\n<p>\u7531\u4e8eetcd\u548cmaster\u8282\u70b9\u5728\u4e00\u8d77\uff0c\u540c\u65f6\u91cd\u542f\u4e24\u4e2amaster\u7684\u65f6\u5019\uff0cetcd\u4e0d\u53ef\u7528\uff0c\u6574\u4e2a\u96c6\u7fa4\u5c31\u4e0d\u53ef\u7528<\/p>\n\n\n\n<p>\u6211\u6d4b\u8bd5\u8fc7\u90e8\u7f725\u4e2aetcd\uff0c\u540c\u65f6\u5173\u95ed\u4e24\u4e2amaster\u7684\u60c5\u51b5\uff0c\u96c6\u7fa4\u4e00\u5207\u6b63\u5e38\uff0cVIP\u6b63\u5e38<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883\uff1a kubernetes\uff1av1.23.6 containerd\uff1a1.6.4 10.10.1.1 maste [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-694","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"views":2423,"_links":{"self":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=694"}],"version-history":[{"count":2,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/694\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/694\/revisions\/696"}],"wp:attachment":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}