当前位置:网站首页>Kubernetes deploying ActiveMQ
Kubernetes deploying ActiveMQ
2022-06-13 11:43:00 【Lyndon1107】
kubernetes Deploy ActiveMQ
Single ActiveMQ Deployment is like deployment Java application , First, rely on docker Make Dockerfile, It's to make sure that docker Mirror image build and run success , Put it in the warehouse , We need to pay attention to ActiveMQ Of jetty.xml To configure .
Then write it manually kubernetes file :activemq-deployment.yml and activemq-service.yml. adopt NodePort Mode exposes the port .
Ready to file
[[email protected] ~]# ls
activemq-deployment.yml activemq-service.yml apache-activemq-5.16.0-bin.tar.gz
dockerfile_activemq jdk-8u251-linux-x64.tar.gz
Dockerfile Make
dockerfile_activemq
[[email protected] ~]# cat dockerfile_activemq
FROM centos:latest
MAINTAINER lyd
ADD jdk-8u251-linux-x64.tar.gz /usr/local/
ADD apache-activemq-5.16.0-bin.tar.gz /usr/local/
RUN cd /usr/local && ls && mv apache-activemq-5.16.0 activemq
ENV JAVA_HOME=/usr/local/jdk1.8.0_251
ENV CLASSPATH=.$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH=$JAVA_HOME/bin:$PATH
EXPOSE 61616 8161
ENTRYPOINT /usr/local/activemq/bin/activemq start && /bin/bash
# docker build -f dockerfile_activemq -t activemq .
# mq Many ports are used , When starting, it is mainly port mapping
# AMQ Use the default 61616 Provide JMS service ,8161 Provide web Control desk service .
# docker run -dit --name activemq -p 61616:61616 -p 8161:8161 activemq
# docker run -dit --name activemq -p 61616:61616 -p 8161:8161 -p 30081:8161 -p 30061:61616 activemq
# netstat -nltp|grep -E '(61616|8161)' View mapped ports
establish docker Mirror image
[[email protected] ~]# docker build -f dockerfile_activemq -t activemq:latest .
push To the warehouse
Sign in docker hub, modify activemq Of tag Enter the warehouse lyndon1107/activemq.
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
lyndon1107/activemq latest 9a0ea80df4a7 2 hours ago 760MB
activemq latest 9a0ea80df4a7 2 hours ago 760MB
k8s.gcr.io/kube-proxy v1.18.16 f64b8b5e96a6 4 weeks ago 117MB
k8s.gcr.io/kube-controller-manager v1.18.16 b3c57ca578fb 4 weeks ago 162MB
k8s.gcr.io/kube-apiserver v1.18.16 26e38f7f559a 4 weeks ago 173MB
k8s.gcr.io/kube-scheduler v1.18.16 5a84bb672db8 4 weeks ago 96.1MB
quay.io/coreos/flannel v0.13.1-rc2 dee1cac4dd20 7 weeks ago 64.3MB
k8s.gcr.io/pause 3.2 80d28bedfe5d 13 months ago 683kB
k8s.gcr.io/coredns 1.6.7 67da37a9a360 13 months ago 43.8MB
k8s.gcr.io/etcd 3.4.3-0 303ce5db0e90 17 months ago 288MB
activemq-deployment.yml
[[email protected] ~]# cat activemq-deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: activemq-deployment
labels:
app: activemq
spec:
replicas: 1
selector:
matchLabels:
app: activemq
template:
metadata:
labels:
app: activemq
spec:
containers:
- name: activemq
image: lyndon1107/activemq:latest
imagePullPolicy: IfNotPresent
command: ["/bin/bash", "-ce", "tail -f /dev/null" ]
ports:
- containerPort: 61616 # Container open port , Exposed to the Service The address of
- containerPort: 8161
nodeName: node2 # Specify the node to run
activemq-service.yml adopt NodePort The pattern is exposed to the outside world 61616 and 8161 port .
[[email protected] ~]# cat activemq-service.yml
apiVersion: v1
kind: Service
metadata:
name: activemq-service # name
labels:
app: activemq
spec:
type: NodePort # The communication mode is node port type
ports:
- name: admin
port: 8161 #service Exposure to the cluster ip On the port
targetPort: 8161 #pod On the port
nodePort: 30081 #Service Open ports
- name: tcp
port: 61616
targetPort: 61616
protocol: TCP
nodePort: 30061
selector:
app: activemq # The label of the container
Execute deployment
[[email protected] ~]# kubectl apply -f activemq-deployment.yml
deployment.apps/activemq-deployment created
[[email protected] ~]# kubectl apply -f activemq-service.yml
service/activemq-service created
[[email protected] ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
activemq-deployment-5fb4cccb97-2zmxh 1/1 Running 0 9m6s
READY 1
[[email protected] ~]# kubectl get all
NAME READY STATUS RESTARTS AGE
pod/activemq-deployment-5fb4cccb97-2zmxh 1/1 Running 0 33m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/activemq-service NodePort 10.101.93.214 <none> 8161:30081/TCP,61616:30061/TCP 33m
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 7h11m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/activemq-deployment 1/1 1 1 33m
NAME DESIRED CURRENT READY AGE
replicaset.apps/activemq-deployment-5fb4cccb97 1 1 1 33m
see node2 node Mirror image Containers
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
lyndon1107/activemq latest 9a0ea80df4a7 6 hours ago 760MB
k8s.gcr.io/kube-proxy v1.18.16 f64b8b5e96a6 4 weeks ago 117MB
k8s.gcr.io/kube-apiserver v1.18.16 26e38f7f559a 4 weeks ago 173MB
k8s.gcr.io/kube-controller-manager v1.18.16 b3c57ca578fb 4 weeks ago 162MB
k8s.gcr.io/kube-scheduler v1.18.16 5a84bb672db8 4 weeks ago 96.1MB
quay.io/coreos/flannel v0.13.1-rc2 dee1cac4dd20 7 weeks ago 64.3MB
k8s.gcr.io/pause 3.2 80d28bedfe5d 13 months ago 683kB
k8s.gcr.io/coredns 1.6.7 67da37a9a360 13 months ago 43.8MB
k8s.gcr.io/etcd 3.4.3-0 303ce5db0e90 17 months ago 288MB
[[email protected] ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
25d443ded154 9a0ea80df4a7 "/bin/bash -ce 'tail…" 3 hours ago Up 3 hours k8s_activemq_activemq-deployment-5fb4cccb97-2zmxh_default_5a618886-82da-42a1-baa0-a72e044e5e99_0
24ccf5de7ac6 k8s.gcr.io/pause:3.2 "/pause" 3 hours ago Up 3 hours k8s_POD_activemq-deployment-5fb4cccb97-2zmxh_default_5a618886-82da-42a1-baa0-a72e044e5e99_0
aceff7459fbb dee1cac4dd20 "/opt/bin/flanneld -…" 9 hours ago Up 9 hours k8s_kube-flannel_kube-flannel-ds-kcwjv_kube-system_602962d2-3a97-4b5e-8ca5-5d3001c7ff62_0
11ce47afaedd k8s.gcr.io/pause:3.2 "/pause" 9 hours ago Up 9 hours k8s_POD_kube-flannel-ds-kcwjv_kube-system_602962d2-3a97-4b5e-8ca5-5d3001c7ff62_0
9eeef13fd2c0 f64b8b5e96a6 "/usr/local/bin/kube…" 10 hours ago Up 10 hours k8s_kube-proxy_kube-proxy-8f7zr_kube-system_0a0d2ad1-3a6a-4a7a-930a-0887391d3389_1
23b9bae030ef k8s.gcr.io/pause:3.2 "/pause" 10 hours ago Up 10 hours k8s_POD_kube-proxy-8f7zr_kube-system_0a0d2ad1-3a6a-4a7a-930a-0887391d3389_1
test
user service Exposed ports 30081 Access address http://192.168.11.8:30081/admin Enter the username and password admin admin
End
About command
deployment Middle mirror position , Additional instructions command
command: ["/bin/bash", “-ce”, “tail -f /dev/null” ] This results in actvemq Maybe the application is not started . Started the empty service .
If the application does not start , Log in to docker In view log , perform ./bin/activemq start, It can be used as a debugging tool .
The easiest way is to Dockerfile Add an empty file to the java -jar xxx.jar && tail -f test file
other
CrashLoopBackOff error
CrashLoopBackOff The meaning is ,Kubernetes Attempt to start the Pod, But there was an error in the process , The container failed to start or is being deleted .
[[email protected] ~]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
activemq-deployment-5fb4cccb97-2zmxh 1/1 Running 0 16h 10.244.3.8 node2 <none> <none>
connect-deployment-74d6746f47-hv7sv 0/1 CrashLoopBackOff 5 6m 10.244.3.17 node2 <none> <none>
pod Report errors "Back-off restarting failed container" terms of settlement
Link address :https://blog.csdn.net/sqhren626232/article/details/101013390
resolvent : stay deployment Add a command after declaring the image
command: [ “/bin/bash”, “-ce”, “tail -f /dev/null” ]
边栏推荐
- Mac 安装 MySQL 教程
- 【真相】大厂招人不怕花钱的原因竟然是。。。
- 【TcaplusDB知识库】Tmonitor单机安装指引介绍(二)
- IDEA 使用
- Performance monster on arm64: installation and performance test of API gateway Apache APIs IX on AWS graviton3
- Audio and video technology development weekly 𞓜 249
- Design and implementation of database for banking system
- TS进阶之条件类型
- Kubernetes问题整理
- 【TcaplusDB知识库】TcaplusDB机型管理介绍
猜你喜欢

ARM64 上的性能怪兽:API 网关 Apache APISIX 在 AWS Graviton3 上的安装和性能测试

camunda如何使用script脚本节点

数位DP例题
![[tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (II)](/img/6d/8b1ac734cd95fb29e576aa3eee1b33.png)
[tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (II)
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area](/img/b7/2358e8cf1cdaeaba77e52d04cc74d4.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area

关于 SAP Spartacus CmsService.getComponentData 可能的优化思路

Fuel scheme and product business modeling

89C51 single chip microcomputer driving LCD based on dream

【TcaplusDB知识库】TcaplusDB常规单据介绍

状态压缩DP例题(旅行商问题和填矩形问题)
随机推荐
『忘了再學』Shell基礎 — 30、sed命令的使用
塔米狗股权项目分享:北京化大化新科技股份有限公司163.79万股股份转让
1051. 高度检查器
[tcapulusdb knowledge base] tcapulusdb doc acceptance - table creation approval introduction
Anonymity in Web3 and NFT
【TcaplusDB知识库】TcaplusDB集群管理介绍
模型搭建过程1==MIIDock
数据库连接数设置多少合适?
Multiplicative inverse action
Four methods of finding combinatorial numbers
Euler function and finding Euler function by linear sieve
Type de condition pour ts Advanced
【TcaplusDB知识库】TcaplusDB单据受理-创建游戏区介绍
Apache apisik v2.14.1 exploratory release to expand into more fields
ARM64 上的性能怪兽:API 网关 Apache APISIX 在 AWS Graviton3 上的安装和性能测试
Miidock file distribution
VSCode 如何将已编辑好的文件中的 tab 键转换成空格键
The leader said he would go online tomorrow, but he didn't know the development process at all
Notes on the development of raspberry pie (16): Raspberry pie 4b+ install MariaDB database (MySQL open source branch) and test basic operations
【TcaplusDB知识库】TcaplusDB单据受理-创建业务介绍