--- apiVersion: apps/v1 kind: Deployment metadata: name: ruoyi-java spec: replicas: 2 selector: matchLabels: app: ruoyi-java template: metadata: labels: app: ruoyi-java spec: containers: - name: ruoyi-java image: 192.168.96.141/library/ruoyi-java:v1.0 ports: - containerPort: 8080 hostAliases: - ip: "192.168.96.160" hostnames: - "mysql.server" - ip: "192.168.96.141" hostnames: - "redis.server" --- apiVersion: v1 kind: Service metadata: name: ruoyi-java-service spec: selector: app: ruoyi-java ports: - port: 8080 targetPort: 8080