当前位置:网站首页>Do280 management application deployment --rc
Do280 management application deployment --rc
2022-07-01 03:57:00 【It migrant worker brother goldfish】
DO280 Manage application deployment –RC
Personal profile : Hello everyone , I am a Brother goldfish ,CSDN New star creator in operation and maintenance field , Hua Wei Yun · Cloud sharing experts , Alicloud community · Expert bloggers
Personal qualifications :CCNA、HCNP、CSNA( Network Analyst ), Soft test primary 、 Intermediate network engineer 、RHCSA、RHCE、RHCA、RHCI、ITIL
Maxim : Hard work doesn't necessarily succeed , But if you want to succeed, you must work hardStand by me : I like it 、 Can collect ️、 Leave message
List of articles
REPLICATION CONTROLLERS
RC summary
RC Make sure pod A specified number of copies are always running . If pod Killed or explicitly deleted by the administrator , The replication controller will automatically deploy the appropriate pod. Similarly , If it runs pod The quantity exceeds the quantity required , It will be removed as needed pod, To match the specified replica count .
RC The definition of :
- Number of copies required
- Use to create replication pod Of pod Definition
- Used to identify subsequent administrative operations selector
selector It's a group. label,RC All that's managed pod Must match these tags .RC Instantiated pod The definition must contain the same set of tags .RC Use this selector To determine how much is running pod example , In order to make adjustments as needed .
Be careful : Do not perform auto zoom , Because it doesn't track load or traffic .
Even though Kubernetes Usually directly manage RC, but OpenShift The recommended approach is to manage the creation or change of RC Of DC.
from DC establish RC
stay OpenShift The most common way to create an application in is to use oc new-app Order or web Console . Applications created in this way use DeploymentConfig Resources are created at run time RC To create an application pod.DeploymentConfig The resource definition defines the pod The number of copies of , And the pod The template of .
** Be careful :** Don't put DeploymentConfig or ReplicationController In resources template Attribute mistaking OpenShift Template resource type ,OpenShift Template resources are used to build applications based on common language runtimes and frameworks .

① Specify the... To run pod Number of copies ( Or copies ).
② The replication controller uses selectors to count running pod The number of , It's like a service using selectors to find the one to load balance pod equally .
③ Created by controller pods Templates .
④ Created by replication controller pods The label on must match the label on the selector **.**
pod Copy number control
DeploymentConfig or ReplicationController The number of copies in the resource can be used oc scale Command dynamic change .
$ oc get dc
NAME REVISION DESIRED CURRENT TRIGGERED BY
myapp 1 3 3 config,image(scaling:latest)
$ oc scale --replicas=5 dc myapp
DeploymentConfig Resources pass change information to ReplicationController, The controller creates a new pod( copy ) Or delete existing pod To respond to changes .
Although it can be operated directly ReplicationController resources , But the recommended practice is operation DeploymentConfig resources . When a deployment is triggered , Direct pair ReplicationController Changes made by resources may be lost , for example , Using a container image A new version of is recreated pod.
Automatic telescopic pod
OpenShift Can pass HorizontalPodAutoscaler The resource type depends on the application pod The current load on automatically adjusts the deployment configuration .
HorizontalPodAutoscaler (HPA) Use of resources OpenShift metrics Performance metrics collected by subsystems , That is, if there is no degree quantum system ( modular ), More specifically Heapster Components , Automatic scaling is not possible .
establish HorizontalPodAutoscaler The recommended method for resources is to use oc autoscale command , for example :
$ oc autoscale dc/myapp --min 1 --max 10 --cpu-percent=80
This command creates a HorizontalPodAutoscaler resources , The resource changes myapp Number of copies on deployment configuration , In order to pod Of CPU Usage is controlled to the total number of requests CPU Used amount 80% following .
oc autoscale Command to use DC As a parameter ( In the previous example myapp) Create a HorizontalPodAutoscaler resources .
HorizontalPodAutoscaler The maximum and minimum values of resources are used to accommodate burst loads , And avoid OpenShift Cluster overload . If the load on the application changes too fast , It is recommended to keep some spare ones pod To handle sudden user requests . contrary , Too much pod All cluster capacity will be exhausted , And affect sharing the same OpenShift Other applications in the cluster .
To get the HorizontalPodAutoscaler Information about resources , You can use oc get and oc describe command . for example
$ oc get hpa/frontend
$ oc describe hpa/frontend
Be careful :HorizontalPodAutoscaler Resources are only applicable to those that define resource requests for reference performance metrics pod.
oc new-app Most of the pod There are no resource requests defined . therefore , Use OpenShift autoscaler You may need to create custom YAML or JSON Resource file , Or add resource scope resources to the project .
Textbook exercises
Environmental preparation
[[email protected] ~]$ lab install-prepare setup
[[email protected] ~]$ cd /home/student/do280-ansible
[[email protected] do280-ansible]$ ./install.sh
Tips : If you already have a complete environment , Don't execute .
Create an
[[email protected] ~]$ oc login -u developer -p redhat https://master.lab.example.com
[[email protected] ~]$ oc new-project scaling
[[email protected] ~]$ oc new-app -o yaml -i php:7.0 \
http://registry.lab.example.com/scaling > ~/scaling.yml # To be deployed yaml Export to local
[[email protected] ~]$ vim ~/scaling.yml
……
spec:
replicas: 3
selector:
app: scaling
deploymentconfig: scaling # Number of modified copies
……
[[email protected] ~]$ oc create -f ~/scaling.yml # To modify the number of copies yaml Deploy the application
Monitor deployment
[[email protected] ~]$ watch -n 3 oc get builds
Every 3.0s: oc get builds Wed Mar 3 21:31:11 2021
NAME TYPE FROM STATUS STARTED DURATION
scaling-1 Source [email protected] Complete About a minute ago 29s
[[email protected] ~]$ oc get pods
NAME READY STATUS RESTARTS AGE
scaling-1-9dd8r 1/1 Running 0 1m
scaling-1-build 0/1 Completed 0 2m
scaling-1-r97zl 1/1 Running 0 1m
scaling-1-z4zdg 1/1 Running 0 1m
Exposure Services
[[email protected] ~]$ oc expose service scaling --hostname=scaling.apps.lab.example.com
web Check out the information
Browser access https://master.lab.example.com, Use developer Users and redhat Password login . choice scaling project .


Test load balancing
[[email protected] ~]$ oc get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE
scaling-1-9dd8r 1/1 Running 0 1h 10.128.0.189 node1.lab.example.com
scaling-1-build 0/1 Completed 0 1h 10.128.0.187 node1.lab.example.com
scaling-1-r97zl 1/1 Running 0 1h 10.129.0.253 node2.lab.example.com
scaling-1-z4zdg 1/1 Running 0 1h 10.128.0.188 node1.lab.example.com
[[email protected] ~]$ for i in {
1..5};do curl -s http://scaling.apps.lab.example.com | grep IP;done
<br/> Server IP: 10.128.0.189
<br/> Server IP: 10.129.0.253
<br/> Server IP: 10.128.0.188
<br/> Server IP: 10.128.0.189
<br/> Server IP: 10.129.0.253
Browsers may not be able to strictly check the balance , because OpenShift route There is session affinity ( Also known as sticky conversation ). From the same one web All requests from the browser will go to the same pod.
Expansion application
[[email protected] ~]$ oc describe dc scaling | grep Replicas
Replicas: 3
Replicas: 3 current / 3 desired
[[email protected] ~]$ oc scale --replicas=5 dc scaling

[[email protected] ~]$ oc get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE
scaling-1-9dd8r 1/1 Running 0 1h 10.128.0.189 node1.lab.example.com
scaling-1-build 0/1 Completed 0 1h 10.128.0.187 node1.lab.example.com
scaling-1-hmzk8 1/1 Running 0 33s 10.129.0.254 node2.lab.example.com
scaling-1-pf9bh 1/1 Running 0 33s 10.129.0.255 node2.lab.example.com
scaling-1-r97zl 1/1 Running 0 1h 10.129.0.253 node2.lab.example.com
scaling-1-z4zdg 1/1 Running 0 1h 10.128.0.188 node1.lab.example.com
Test load balancing
[[email protected] ~]$ for i in {
1..5};do curl -s http://scaling.apps.lab.example.com | grep IP;done
<br/> Server IP: 10.128.0.188
<br/> Server IP: 10.128.0.189
<br/> Server IP: 10.129.0.253
<br/> Server IP: 10.129.0.254
<br/> Server IP: 10.129.0.255
Clear the experiment
[[email protected] ~]$ oc delete project scaling
project "scaling" deleted
summary
RHCA Certification requires experience 5 Study and examination of the door , It still takes a lot of time to study and prepare for the exam , Come on , Can GA 🤪.

That's all 【 Brother goldfish 】 Yes Chapter vii. DO280 Manage application deployment –RC Brief introduction and explanation of . I hope it can be helpful to the little friends who see this article .
Red hat Certification Column series :
RHCSA special column : entertain RHCSA authentication
RHCE special column : entertain RHCE authentication
This article is included in RHCA special column :RHCA memoir
If this article 【 article 】 It helps you , I hope I can give 【 Brother goldfish 】 Point a praise , It's not easy to create , Compared with the official statement , I prefer to use 【 Easy to understand 】 To explain every point of knowledge with your writing .
If there is a pair of 【 Operation and maintenance technology 】 Interested in , You are welcome to pay attention to ️️️ 【 Brother goldfish 】️️️, I will bring you great 【 Harvest and surprise 】!

边栏推荐
- 242. 有效的字母异位词
- 30. Concatenate substrings of all words
- JMeter login failure, extracting login token, and obtaining token problem solving
- You cannot right-click F12 to view the source code solution on the web page
- Appium automation test foundation -- supplement: c/s architecture and b/s architecture description
- [party benefits] jsonobject to string, leave blank
- 【TA-霜狼_may-《百人计划》】1.4 PC手机图形API介绍
- 389. 找不同
- 214. minimum palindrome string
- 6. Z 字形变换
猜你喜欢

Appium automation test foundation -- supplement: c/s architecture and b/s architecture description
![[TA frost wolf \u may- hundred talents plan] 1.2.2 matrix calculation](/img/49/173b1f1f379faa28c503165a300ce0.png)
[TA frost wolf \u may- hundred talents plan] 1.2.2 matrix calculation
![[TA frost wolf \u may- hundred talents plan] 1.2.3 MVP matrix operation](/img/4e/8cf60bc816441967c04f97c64685a1.png)
[TA frost wolf \u may- hundred talents plan] 1.2.3 MVP matrix operation

25.K个一组翻转链表

使用selenium自动化测试工具爬取高考相关院校专业招生分数线及排名情况

Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)

【TA-霜狼_may-《百人計劃》】2.3 常用函數介紹

【人话版】WEB3黑暗森林中的隐私博弈

Complete knapsack problem

Idea plug-in backup table
随机推荐
8. string conversion integer (ATOI)
TS type gymnastics: illustrating a complex advanced type
【EI会议】2022年国际土木与海洋工程联合会议(JCCME 2022)
[TA frost wolf \u may - "hundred people plan"] 2.1 color space
LeetCode 1399. Count the maximum number of groups
【EI会议】2022年第三届纳米材料与纳米技术国际会议(NanoMT 2022)
Qt开发经验小技巧226-230
[TA frost wolf \u may- hundred people plan] 2.4 traditional empirical lighting model
【人话版】WEB3黑暗森林中的隐私博弈
[JPCs publication] the Third International Conference on control theory and application in 2022 (icocta 2022)
DO280管理应用部署--RC
Use of comment keyword in database
165. compare version numbers
LeetCode 1380. Lucky number in matrix
谷粒学院微信扫码登录过程记录以及bug解决
【TA-霜狼_may-《百人计划》】1.2.2 矩阵计算
【无标题】
All in one 1086: Jiaogu conjecture
The problem of integrating Alibaba cloud SMS: non static methods cannot be referenced from the static context
“目标检测“+“视觉理解“实现对输入图像的理解