[root@master01 tmp]# cat activemq.yaml apiVersion: v1 kind: Service metadata: name: nodeport-activemq namespace: chongqing spec: selector: app: activemq ports: - port: 8161 targetPort: 8161 protocol: TCP name: admin nodePort: 30004 - port: 61616 targetPort: 61616 protocol: TCP name: tcp nodePort: 30005 type: NodePort --- apiVersion: apps/v1 kind: Deployment metadata: name: deploy-activemq namespace: chongqing 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 apply -f activemq.yaml