apiVersion: v1
kind: Service
metadata:
name: activemq
namespace: xxx
spec:
selector:
app: activemq
ports:
- port: 8161
targetPort: 8161
protocol: TCP
name: admin
- port: 61616
targetPort: 61616
protocol: TCP
name: tcp
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-activemq
namespace: xxx
spec:
replicas: 1
selector:
matchLabels:
app: activemq
template:
metadata:
labels:
app: activemq
spec:
containers:
- name: activemq
image: webcenter/activemq
ports:
- containerPort: 8161
protocol: TCP
- containerPort: 61616
protocol: TCP
使用下面命令查看暴露的端口号
kubectl get svc -n xxx