In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to use kubefed to build Kubernetes Federation. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Using kubefed to establish Kubernetes Federation
Kubernetes Federation is a management mechanism that implements multiple Kubernetes clusters across regions and service providers. The structure of Kubernetes Federation is very similar to that of Kubenretes sets. Federation will have its own API Server and Controller Manager to provide a standard Kubernetes API, manage state sets, and use Etcd to store all status, except that Kubenretes only manages multiple nodes, while Federation manages all Kubernetes sets that have been blocked.
Federation makes it easier to manage multiple clusters, which is mainly achieved through several models:
Resource synchronization across clusters (Sync resources across clusters): provides the ability to keep resources synchronized in multiple clusters, such as ensuring that a Deployment can exist in multiple clusters.
Service discovery across clusters (Cross cluster discovery:): provides automatic configuration of DNS services and backup balancing functions on all cluster backends, such as providing global VIP or DNS record, and accessing multiple cluster backends through this.
Federation has the following advantages:
Resource scheduling across clusters allows Pod to be assigned to different nodes of different clusters. If the pre-cluster set exceeds the load, the external attachment can be allocated to the free cluster.
The high reliability of the data set makes it possible to move Pod faults automatically.
Multiple Kubernetes clusters can be managed.
Service discovery across clusters.
Although Federation can greatly reduce the cost of managing multi-cluster, it is not recommended to put it into the production environment at present. There are two reasons:
At present, the issue of maturity is still in the process of Alpha, so many functions are still in practice or are not very stable.
Increase network performance and cost, because Federation needs to monitor all clusters to ensure that the previous status is in line with expectations, because it will increase external performance.
Cross-set quarantine, the subset git of Federation may affect other set traffic conditions due to the initiation of Bug.
Personal use is not very stable, such as the establishment of Deployment to delete the very regular Timeout.
The resources of supported objects are limited, such as not supporting StatefulSets. You can refer to API resources.
Federation consists of three main components:
Federation-apiserver: mainly provides cross-set REST API servers, similar to kube-apiserver.
Federation-controller-manager: provides status synchronization between multiple clusters, similar to kube-controller-manager.
The kubefed:Federation CLI tool is used to initialize Federation components and add subsets.
Brief information
This installation uses Ubuntu 16.04Server as the system system to test the environment as the real machine, with a total of three sets:
Federation control plane cluster (name F):
IP AddressHostvCPURAM172.22.132.31k8s-f-m1416G172.22.132.32k8s-f-n1416G
Set A:
IP AddressHostvCPURAM172.22.132.41k8s-a-m1816G172.22.132.42k8s-a-n1816G
Collection B:
IP AddressHostvCPURAM172.22.132.51k8s-b-m1816G172.22.132.52k8s-b-n1816G prepares beforehand
Before going into Federation, you need to ensure that the following conditions are met:
The nodes of all clusters are deployed into a single Kubernetes cluster. See deploying a Kubernetes cluster with kubeadm.
Modify the Kubernetes config of sets F, A, and B, and copy An and B to the F node, such as:
. Name: K8sMurahouse clustercontext-context: cluster: k8s-a-cluster user: a-cluster-admin name: a-cluster-contextcurrent-context: a-cluster-contextkind: Configpreferences: {} users:- name: a-cluster-admin user:...
This requires modification of each cluster config.
Then assemble the three config of F, An and B in the F cluster, and do so in the following ways:
$lsa-cluster.conf b-cluster.conf fmurcluster.conf$ KUBECONFIG=f-cluster.conf:a-cluster.conf:b-cluster.conf kubectl config view-- flatten > ~ / .kube/config$ kubectl config get-contextsCURRENT NAME CLUSTER AUTHINFO NAMESPACE a-cluster-context k8s-a-cluster a-cluster-admin b-cluster-context k8s-b-cluster BMZ clusterMutual admins * f- Cluster-context k8s-f-cluster f-cluster-admin
Install the kubefed tool in the F sets:
$wget https://storage.googleapis.com/kubernetes-federation-release/release/v1.9.0-alpha.3/federation-client-linux-amd64.tar.gz$ tar xvf federation-client-linux-amd64.tar.gz$ cp federation/client/bin/kubefed / usr/local/bin/$ kubefed versionClient Version: version.Info {Major: "1", Minor: "9 +", GitVersion: "v1.9.0-alpha.3", GitCommit: "85c06145286da663755b140efa2b65f793cce9ec", GitTreeState: "clean", BuildDate: "2018-02-14T12:54:40Z" GoVersion: "go1.9.1", Compiler: "gc", Platform: "linux/amd64"} Server Version: version.Info {Major: "1", Minor: "9", GitVersion: "v1.9.6", GitCommit: "9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState: "clean", BuildDate: "2018-03-21T15:13:31Z", GoVersion: "go1.9.3", Compiler: "gc", Platform: "linux/amd64"}
Install the Helm tool in the F cluster and initialize it:
$wget-qO- https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-linux-amd64.tar.gz | tar-zxf$ sudo mv linux-amd64/helm / usr/local/bin/$ kubectl-n kube-system create sa tiller$ kubectl create clusterrolebinding tiller-- clusterrole cluster-admin-- serviceaccount=kube-system:tiller$ helm init-- service-account tiller# wait for a few minutes$ helm versionClient: & version.Version {SemVer: "v2.8.1", GitCommit: "6af75a8fd72e2aa18a2b278cfe5c7a1c5feca7f2" GitTreeState: "clean"} Server: & version.Version {SemVer: "v2.8.1", GitCommit: "6af75a8fd72e2aa18a2b278cfe5c7a1c5feca7f2", GitTreeState: "clean"} deploy Kubernetes Federation
Since this article uses physical machines to deploy Kubernetes sets, it is impossible for GCP to provide DNS services to Federation, so it is necessary to use CoreDNS to build custom DNS services.
CoreDNS installation
First install the Etcd used by CoreDNS via Helm:
$helm install-- namespace federation-- name etcd-operator stable/etcd-operator$ helm upgrade-- namespace federation-- set cluster.enabled=true etcd-operator stable/etcd-operator$ kubectl-n federation get poNAME READY STATUS RESTARTS AGEetcd-operator-etcd-operator-etcd-backup-operator-577d56449zqkj2 1 use 1 Running 0 1 metcdmuri operator Operator-56679fb56-fpgmm 1/1 Running 0 1metcd-operator-etcd-operator-etcd-restore-operator-65b6cbccl7kzr 1/1 Running 0 1m
When you are finished, you can install CoreDNS to provide custom DNS services:
$cat
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.