ActiveMQ部署记录
镜像制作
-
具体Dockerfile
docker build -t hub.nlfow.cn/activemq:5.15.10 -f ActiveMQ_Dockerfile .
### ### ActimveMQ 5.15.10 ### ### ActiveMQ WebConsole available at http://0.0.0.0:8161/ FROM openjdk:8u262 ENV ACTIVEMQ_HOME /usr/local/activemq ENV PATH $ACTIVEMQ_HOME/bin:$PATH WORKDIR $ACTIVEMQ_HOME ADD https://archive.apache.org/dist/activemq/5.15.10/apache-activemq-5.15.10-bin.tar.gz $ACTIVEMQ_HOME RUN set -x \ && apt-get update \ && apt-get install --no-install-recommends --no-install-suggests -y net-tools vim telnet \ && tar -zxvf apache-activemq-5.15.10-bin.tar.gz \ && mv apache-activemq-5.15.10/* ./ \ && rm -rf apache-activemq-5.15.10 apache-activemq-5.15.10-bin.tar.gz \ && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime EXPOSE 8161/tcp EXPOSE 61616/tcp EXPOSE 5672/tcp CMD ["activemq","console"]
-
创建StatefulSet.yaml,如下
kubectl apply -f sit03-activemq.yaml
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: sit03-activemq-sc namespace: sit provisioner: diskplugin.csi.alibabacloud.com parameters: type: cloud_ssd reclaimPolicy: Retain volumeBindingMode: WaitForFirstConsumer allowVolumeExpansion: true --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: sit03-activemq-pvc namespace: sit spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi storageClassName: sit03-activemq-sc --- apiVersion: apps/v1 kind: StatefulSet metadata: name: sit03-activemq namespace: sit labels: activemq: sit03-activemq spec: replicas: 1 selector: matchLabels: activemq: sit03-activemq serviceName: sit03-activemq template: metadata: labels: activemq: sit03-activemq spec: tolerations: - operator: "Equal" #- operator: "Exists" key: "resource" value: "sit-base" nodeSelector: kubernetes.io/resource: sit-base containers: - name: activemq #image: registry:2.6.2 image: hub.nflow.cn/activemq:5.15.10 #env: # - name: REGISTRY_HTTP_ADDR # value: ":80" # - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY # value: "/var/lib/registry" ports: - name: admin containerPort: 8161 - name: service containerPort: 61616 volumeMounts: - name: activemq-data mountPath: "/usr/local/activemq/data/kahadb" readinessProbe: tcpSocket: port: 8161 initialDelaySeconds: 60 timeoutSeconds: 10 livenessProbe: tcpSocket: port: 8161 initialDelaySeconds: 60 timeoutSeconds: 10 volumes: #- name: image-store # emptyDir: {} - name: activemq-data persistentVolumeClaim: claimName: sit03-activemq-pvc --- kind: Service apiVersion: v1 metadata: name: sit03-activemq namespace: sit labels: activemq: sit03-activemq spec: selector: activemq: sit03-activemq externalIPs: - 10.1.48.201 ports: - name: admin port: 8161 targetPort: 8161 - name: service port: 61616 targetPort: 61616