当前位置:网站首页>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 】!

边栏推荐
猜你喜欢

25.K个一组翻转链表

Use selenium automated test tool to climb the enrollment score line and ranking of colleges and universities related to the college entrance examination

The problem of integrating Alibaba cloud SMS: non static methods cannot be referenced from the static context

DO280管理应用部署--RC

“目标检测“+“视觉理解“实现对输入图像的理解

Processing of menu buttons on the left and contents on the right of the background system page, and double scrolling appears on the background system page

LeetCode 1828. Count the number of points in a circle

Quickly filter data such as clock in time and date: Excel filter to find whether a certain time point is within a certain time period

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

定了!2022京东全球科技探索者大会之京东云峰会7月13日北京见
随机推荐
LeetCode 1380. Lucky number in matrix
431. 将 N 叉树编码为二叉树 DFS
242. valid Letter heteronyms
AfxMessageBox和MessageBox的用法
【TA-霜狼_may-《百人计划》】2.3 常用函数介绍
Processing of menu buttons on the left and contents on the right of the background system page, and double scrolling appears on the background system page
187. 重复的DNA序列
快速筛选打卡时间日期等数据:EXCEL筛选查找某一时间点是否在某一时间段内
Use selenium automated test tool to climb the enrollment score line and ranking of colleges and universities related to the college entrance examination
409. 最长回文串
互联网行业最佳产品开发流程 推荐!
What does ft mean in the data book table
Database DDL (data definition language) knowledge points
JMeter学习笔记2-图形界面简单介绍
PageObject模式解析及案例
Go learning --- unit test subtest
30. Concatenate substrings of all words
类和对象收尾
Review column - message queue
[TA frost wolf \u may- hundred talents plan] 1.2.2 matrix calculation