当前位置:网站首页>Create PHP message board system with kubernetes
Create PHP message board system with kubernetes
2022-07-29 10:23:00 【Brother Xing plays with the clouds】
This article will demonstrate the use of kubernetes The system is based on kubeguide Related image files are created based on php and Redis Message board system of , Because the system resources are limited ,kubernetes colony only one master Nodes and slave node .
Docker Local warehouse and kubernetes colony Please check the configuration https://www.linuxidc.com/Linux/2018-03/151136.htm.
One 、 Introduction to the environment Operating system version :CentOS linux 7.2 64bit Master node :192.168.115.5/24 vm1 Slave node 1:192.168.115.6/24 vm2
The access flow chart is as follows :
Two 、 Download relevant image files online , And incorporated into the local warehouse for unified management
# docker pull kubeguide/redis-master # docker pull kubeguide/guestbook-php-frontend # docker pull kubeguide/guestbook-redis-slave # docker tag kubeguide/redis-master registry.fjhb.cn/redis-master # docker tag kubeguide/guestbook-php-frontend registry.fjhb.cn/guestbook-php-frontend # docker tag kubeguide/guestbook-redis-slave registry.fjhb.cn/guestbook-redis-slave # docker push registry.fjhb.cn/redis-master # docker push registry.fjhb.cn/guestbook-php-frontend # docker push registry.fjhb.cn/guestbook-redis-slave # curl -u yang:123 -XGET https://registry.fjhb.cn/v2/_catalog # docker images |grep fjhb
3、 ... and 、 Configuration file preparation 1、 establish redis-master rc and service The configuration file
# cat redis-master-controller.yaml apiVersion: v1 kind: ReplicationController metadata: name: redis-master spec: replicas: 1 selector: name: redis-master template: metadata: name: redis-master labels: name: redis-master spec: containers: - name: redis-master image: registry.fjhb.cn/redis-master ports: - containerPort: 6379# cat redis-master-service.yaml apiVersion: v1 kind: Service metadata: name: redis-master labels: name: redis-master spec: ports: - port: 6379 targetPort: 6379 selector: name: redis-master
2、 establish redis-slave Of rc and service The configuration file
# cat redis-slave-controller.yaml apiVersion: v1 kind: ReplicationController metadata: name: redis-slave spec: replicas: 2 selector: name: redis-slave template: metadata: name: redis-slave labels: name: redis-slave spec: containers: - name: redis-slave image: registry.fjhb.cn/guestbook-redis-slave env: - name: GET_HOSTS_FROM value: env ports: - containerPort: 6379# cat redis-slave-service.yaml apiVersion: v1 kind: Service metadata: name: redis-slave labels: name: redis-slave spec: ports: - port: 6379 selector: name: redis-slave
3、 establish frontend Of rc and service The configuration file
# cat frontend-controller.yaml apiVersion: v1 kind: ReplicationController metadata: name: frontend labels: name: frontend spec: replicas: 3 selector: name: frontend template: metadata: labels: name: frontend spec: containers: - name: frontend image: registry.fjhb.cn/guestbook-php-frontend env: - name: GET_HOSTS_FROM value: env ports: - containerPort: 80# cat frontend-service.yaml apiVersion: v1 kind: Service metadata: name: frontend labels: name: frontend spec: type: NodePort ports: - port: 80 nodePort: 30001 selector: name: frontend
Four 、 stay master Create... On node rc and sevices
# kubectl create -f redis-master-controller.yaml # kubectl create -f redis-slave-controller.yaml # kubectl create -f frontend-controller.yaml # kubectl create -f redis-master-service.yaml # kubectl create -f redis-slave-service.yaml # kubectl create -f frontend-service.yaml # kubectl get rc # kubectl get svc # kubectl get pod
# kubectl describe pod redis-slave-gsk1p
could not be built pod The main reason is that the image cannot be pulled from the local warehouse , Even if the image already exists locally , Also report this error . because kubernetes Of imagePullPolicy The default value of the image policy is Always
From our local warehouse nginx Configured with basic verification , Therefore, the error is reported as follows Error syncing pod, skipping: failed to "StartContainer" for "redis-slave" with ErrImagePull: "unauthorized: authentication required" close nginx basic After certification , Try again , Sure enough, there is no problem .
stay Kubernetes Use private warehouses in and support basic The final solution of authentication is to configure kubernetes Of serviceaccount, The detailed configuration will be introduced in subsequent articles .
6、 ... and 、 test 1、 see redis master Node redis colony Information
# kubectl exec redis-master-9993n redis-cli info |grep -A 5 "Replication" # kubectl exec redis-slave-gnq41 redis-cli info |grep -A 5 "Replication" # kubectl exec redis-slave-nvscp redis-cli info |grep -A 5 "Replication"
2、web test
adopt firebug The plug-in can be seen as php+apache In providing web service
7、 ... and 、 rc and service The deletion of
# kubectl delete -f frontend-controller.yaml # kubectl delete -f redis-master-controller.yaml # kubectl delete -f redis-slave-controller.yaml # kubectl delete -f redis-slave-service.yaml # kubectl delete -f redis-master-service.yaml # kubectl delete -f frontend-service.yaml
边栏推荐
- Functions and arrays
- MySQL optimization theory study guide
- Follow teacher Li to learn line generation determinant (continuous update)
- A sharp tool for data visualization Seaborn easy to get started
- 【日志框架】
- 跟着田老师学实用英语语法(持续更新)
- 造型科幻、标配6安全气囊,风行·游艇11.99万起售
- Enterprise architecture | togaf architecture capability framework
- Consumer electronics, frozen to death in summer
- 熊市下PLATO如何通过Elephant Swap,获得溢价收益?
猜你喜欢

Attachment of text of chenjie Report

Geeer's happiness | is for the white whoring image! Analysis and mining, NDVI, unsupervised classification, etc

Two MySQL tables with different codes (utf8, utf8mb4) are joined, resulting in index failure

Consumer electronics, frozen to death in summer

“为机器立心”:朱松纯团队搭建人与机器人的价值双向对齐系统,解决人机协作领域的重大挑战
![[paper reading] i-bert: integer only Bert quantification](/img/2e/4f574b266ec6fc88ffa5dab56f2b8d.png)
[paper reading] i-bert: integer only Bert quantification
![[Yugong series] go teaching course 010 in July 2022 - Boolean and character types of data types](/img/3c/eaadcc105377f012db5ee8852b5e28.png)
[Yugong series] go teaching course 010 in July 2022 - Boolean and character types of data types

Implementation of college logistics repair application system based on SSM

ECCV 2022 | CMU proposes to recurse on the visual transformer without adding parameters, and the amount of calculation is still small

Examples of specific usage of diagnostic instructions in s7-1200 and s7-1500 (led+devicestates+modulestates)
随机推荐
JS temporary dead zone_ Temporary
This is an incomplete data competition Yearbook!
消费电子,冻死在夏天
全面、详细的SQL学习指南(MySQL方向)
The function of that sentence
Geeer's happiness | is for the white whoring image! Analysis and mining, NDVI, unsupervised classification, etc
函数和数组
MySQL infrastructure: SQL query statement execution process
[IVI] 17.1 debugging pit FAQ (compilation)
The purpose of DDD to divide domains, sub domains, core domains, and support domains
12代酷睿处理器+2.8K OLED华硕好屏,灵耀14 2022影青釉商务轻薄本
Is it safe to open an account online now? Do you want to know that you must go to the business hall to open an account now?
网络图片转换本地图片 - 默认值或快捷键
函数——(C游记)
What is Cartland number? What are the applications?
[jetson][reprint]pycharm installed on Jetson
MySQL logging system: binlog, redo log and undo log
这是一份不完整的数据竞赛年鉴!
Intel joins hands with datawhale to launch learning projects!
Reasons for the rise of DDD and its relationship with microservices