In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Operator refers to a class of cloud native expansion services based on Kubernetes custom resource objects (CRD) and controllers (Controller), in which CRD defines the custom resource objects created and managed by each operator, and Controller contains the operation and maintenance logic code related to managing these objects.
For ordinary users, if you want to deploy a highly available etcd cluster in a K8s cluster, you not only need to understand its relevant configuration, but also need specific etcd expertise to complete maintenance arbitration, reconfigure cluster members, create backups, handle disaster recovery and other tedious events.
With the help of extension services such as operator, we can use easy-to-understand YAML files (similarly refer to Deployment) to declare configuration, create and manage our etcd cluster. Let's take a look at the architecture of etcd-operator and some of the functions it contains.
Target
Understand the architecture of etcd-operator and CRD resource objects
Deploy etcd-operator
Create an etcd cluster using etcd-operator
Backup and restore etcd cluster based on etcd-operator
Service architecture
The design of etcd-operator is based on the API Extension mechanism of K8s. It designs a Controller similar to Deployment for users, but this Controller is used to manage the etcd service.
By default, users interact with K8s API through kubectl or UI, except that there is a user-defined controller (custom controller) in this K8s cluster, and the operator controller service runs in the K8s cluster in the way of Pod. At the same time, this service also needs to configure the required RBAC permissions (such as adding, deleting, changing and querying the resources used by Pod,Deployment,Volume). Let's use a simple architecture diagram to illustrate:
Custom Resource object (CRD) for etcd-operator
In K8s, all custom Controller and its custom resource objects (CRD) must meet the specification of K8s API (see figure below):
ApiVersion describes the version number of the current custom resource object
Kind represents the name of the custom resource object. You can get the created CRD object by executing kubectl get $KIND_NAME.
Metadata inherits the native k8s metadata to add metadata such as tags and Annotations.
Spec is a custom designed service configuration parameter, such as mirror version number, number of nodes, resource configuration, etc.
Status contains the relevant status of the current resource. Each operator controller can customize the information contained in status. Generally, you will choose to add information such as conditions,updateTime and message.
Let's first take a look at several custom resource objects (CRDs) that etcd-operator contains:
1. EtcdCluster: etcdcluster is used to describe a user-defined etcd cluster, and a related etcd cluster can be deployed and configured with one click.
ApiVersion: etcd.database.coreos.com/v1beta2kind: EtcdClustermetadata: name: etcd-clusterspec: size: 3 version: 3.2.25
2. EtcdBackup: etcdbackup is used to describe and manage the backups of an etcd cluster. Regular backups are supported to cloud storage, such as AWS S3 and Aliyun oss (quay.io/coreos/etcd-operator:dev image is currently required for oss).
ApiVersion: etcd.database.coreos.com/v1beta2kind: EtcdBackupmetadata: name: etcd-backupspec: etcdEndpoints: [] storageType: OSS # options are S3/ABS/GCS/OSS backupPolicy: backupIntervalInSecond: 125 maxBackups: 4 oss: # "/" path: ossSecret: # Details about regions and endpoints, see https://www.alibabacloud.com/help/doc-detail/31837.htm endpoint:
3. EtcdRestore:etcdrestore is used to help restore backups created by the etcdbackup service to a specified etcd cluster.
ApiVersion: etcd.database.coreos.com/v1beta2kind: EtcdRestoremetadata: # name must be same to the spec.etcdCluster.name name: example-etcd-clusterspec: etcdCluster: name: example-etcd-cluster backupStorageType: OSS oss: path: ossSecret: endpoint: how to deploy and use etcd-operator
1. Deploy etcd-operator
In the latest version of stable v2.3.2 of Rancher, users can deploy etcd-operator v0.9.0 with one click through the App Store (Catalog). At the same time, native k8s can also download rancher/charts locally and deploy it through helm install.
1) (optional) when deploying etcd-operator, you can choose to create an etcd cluster at the same time (this cluster will be removed when etcd-operator is deleted). Of course, users can also wait for etcd-operator deployment to create a new etcd cluster through kubectl apply-f myetcd.yaml.
2) during deployment, if the user chooses to start Enable Clusterwide of etcd Operator, the etcd-operator will be used as a cluster-level object (otherwise, it will be namespaced isolated). If enable is selected, the following comments need to be added when creating an etcd cluster:
Kind: EtcdClustermetadata: name: etcd-cluster # add this annotation when the clusterWide is enabled annotations: etcd.database.coreos.com/scope: clusterwide
2. Create an etcd cluster
We can then use the above CRD custom resource object pair to create and manage our etcd cluster.
2.1 manually create an etcd cluster
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.