drools8尝试(集群部署)

Dockerfile

FROM docker.io/library/openjdk:11-jre
ARG JAR_FILE=03-1.0-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar
EXPOSE 8080
ENTRYPOINT [ "java", "-jar", "/app.jar" ]

其中 jar是maven模板项目的产出

然后
podman build -t 172.16.251.151:30009/drools8/drools8:1.0 .
podman push 172.16.251.151:30009/drools8/drools8:1.0 (如果没有的话需先手动在harbor里新建drools8项目)

yaml文件
从harbor拉镜像,把镜像内使用的8080映射到服务器的30006端口

apiVersion: v1
kind: Namespace
metadata:
  name: drools8

---

apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: drools8
  name: drools8
  namespace: drools8
spec:
  type: NodePort
  ports:
    - port: 8080
      targetPort: 8080
      nodePort: 30006
  selector:
    k8s-app: drools8

---

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: drools8
  name: drools8
  namespace: drools8
spec:
  replicas: 3
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s-app: drools8
  template:
    metadata:
      labels:
        k8s-app: drools8
    spec:
      dnsPolicy: Default
      containers:
        - name: drools8
          image: 172.16.251.151:30009/drools8/drools8:1.0
          #本地有则使用本地镜像,不拉取
          imagePullPolicy: IfNotPresent 
          ports:
            - containerPort: 8080
              protocol: TCP

Swagger文件见:

http://172.16.251.152:30006/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config#/

当然,这些应该jenkins做 , 或者CICD持续集成

你可能感兴趣的:(规则引擎)