In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
ReplicaSet
RC: ReplicationController (older generation Pod controller)
It is used to ensure that the number of copies of Pod objects controlled by it can meet user expectations. If there are more copies, delete them. If there are fewer copies, create them through templates.
Features:
Ensure that the number of objects for Pod resources is accurate Ensure that Pod monitoring runs Auto Scaling.
Similarly, it can be created from resource lists in yaml or json format. The spec field is usually nested with the following fields
replicas: expected number of copies of a Pod object selector: label selector for which the current controller matches copies of a Pod object template: template for copies of a Pod object
Compared with RC, RS supports not only equivalent-based label selector, but also set-based label selector.
Tags: solve the problem of more and more resource objects of the same type. For better management, group them according to tags.
Common label categories:
release: stable, canary, beta
environment: dev, qa, production
application: ui, as(application software), pc, sc
tier: frontend, backend, cache
partition: customerA, customerB
triack: daily, weekly
Labels should be done: see the name to know the meaning.
[root@master ~]# vim label.yaml
kind: PodapiVersion: v1metadata: name: labels labels: env: qa tier: frontendspec: containers: - name: myapp image: httpd
[root@master ~]# kubectl apply -f label.yaml
pod/labels created
//Show labels for resource objects via--show-labels.
[root@master ~]# kubectl get pod --show-labels
//view resources with only one tag via-l
[root@master ~]# kubectl get po -L env,tier
[root@master ~]# kubectl get po -l env,tier
Add tags to labels resources:
[root@master ~]# kubectl label pod labels app=pcpod/labels labeled
View labels Resource tags:
[root@master ~]# kubectl get pod -l app
[root@master ~]# kubectl get pod -l tier --show-labels
Remove labels from labels resources:
[root@master ~]# kubectl label pod labels app-pod/labels labeled
Modify labels for labels resources:
[root@master ~]# kubectl label pod labels env=dev --overwrite pod/labels labeled
[root@master ~]# vim label-svc.yaml
apiVersion: v1kind: Servicemetadata: name: labels-svcspec: type: NodePort selector: env: qa tier: frontend ports: - protocol: TCP port: 80 targetPort: 80[root@master ~]# kubectl apply -f label-svc.yaml service/labels-svc created[root@master ~]# kubectl describe svc labels-svc
If there are multiple labels, the label selector selects one of them, and the association can be successful. On the contrary, if there are multiple selectors, the label must fully meet the conditions before the association can be successful!
Tag selector: query filter criteria for tags.
(equality-based):"=","==","! "The first two are equal and the last is unequal.
Set-based: in, notin, exits.
Examples:
[root@master ~]# vim slector.yaml
selector: matchLabels: app: nginx matchExpressions: - {key: name,operator: In,values: [zhangsan,lisi]} - {key: age,operator: Exists,values:}
matchLabels: Specifies the label selector represented by the key-value pair.
matchExpressions: Label selectors specified based on expressions. Selector lists are logically AND'd; values do not force a non-empty list of strings when ln or Notln is used, and values must be empty when Exists or DostNotExist is used.
Logic to use label selector:
The logical relationship between multiple labels specified at the same time is an AND operation. A label selector with a null value means that every resource object will be selected. An empty label selector cannot select any resources. DaemonSet
It is also a Pod controller.
Usage scenario: If the Pod must be run on a fixed node or nodes and take precedence over other pods. Normally, by default, each node runs and only one Pod can run. DaemonSet resource objects are recommended in this case.
Monitoring procedures:
Log Collector:
[root@master ~]# kubectl get ds -n kube-system
Run a web application that runs a Pod on each node.
[root@master ~]# vim daemonset.yaml
kind: DaemonSetapiVersion: extensions/v1beta1metadata: name: test-dsspec: template: metadata: labels: name: test-ds spec: containers: - name: test-ds image: httpd
[root@master ~]# kubectl apply -f daemonset.yaml
daemonset.extensions/test-ds created
RC, RS, Deployment, DaemonSet。Pod controller. statfulSet,lngress。pod
RBAC. User-Based Authentication and Authorization Mechanism
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.