构建镜像

上传jar包后,编写dockerfile文件,运行docker build

上传镜像

登录docker login
打标签
push

ntpdate -u ntp.api.bz
chmod 755 tapd-app-1.0.1.jar 
vim dockerfile 
docker build -t tapd-connect:v1.0 .
docker images | grep tapd
docker tag tapd-connect:v1.0  df1024/tapd-connect:v1.0
docker login
docker push df1024/tapd-connect:v1.0

k8s部署模式

在这里插入图片描述
容器信息
在这里插入图片描述

镜像的nodeport服务

在这里插入图片描述

---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    k8s.kuboard.cn/displayName: tapd-connect
  labels:
    k8s.kuboard.cn/name: tapd-connect
  name: tapd-connect
  namespace: default
  resourceVersion: '273134'
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s.kuboard.cn/name: tapd-connect
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        k8s.kuboard.cn/name: tapd-connect
    spec:
      containers:
        - image: 'df1024/tapd-connect:v1.0'
          imagePullPolicy: IfNotPresent
          name: tapd-connect
          ports:
            - containerPort: 8080
              hostPort: 8080
              protocol: TCP
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
        - name: ylr
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
    - lastTransitionTime: '2022-03-10T08:36:40Z'
      lastUpdateTime: '2022-03-10T08:36:40Z'
      message: Deployment has minimum availability.
      reason: MinimumReplicasAvailable
      status: 'True'
      type: Available
    - lastTransitionTime: '2022-03-10T08:34:13Z'
      lastUpdateTime: '2022-03-10T08:36:40Z'
      message: ReplicaSet "tapd-connect-76dd9575f5" has successfully progressed.
      reason: NewReplicaSetAvailable
      status: 'True'
      type: Progressing
  observedGeneration: 2
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1

---
apiVersion: v1
kind: Service
metadata:
  annotations: {}
  labels:
    k8s.kuboard.cn/name: tapd-connect
  name: tapd-connect
  namespace: default
  resourceVersion: '273526'
spec:
  clusterIP: 10.104.133.35
  clusterIPs:
    - 10.104.133.35
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  ports:
    - name: zkjksc
      nodePort: 30891
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    k8s.kuboard.cn/name: tapd-connect
  sessionAffinity: None
  type: NodePort
status:
  loadBalancer: {}


mysql的endpoint服务

---
apiVersion: v1
kind: Service
metadata:
  annotations: {}
  name: mysql-windows
  namespace: default
  resourceVersion: '158516'
spec:
  clusterIP: 10.101.14.214
  clusterIPs:
    - 10.101.14.214
  internalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  ports:
    - name: http
      port: 3306
      protocol: TCP
      targetPort: 3306
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}


在这里插入图片描述

rabbitmq的endpoint服务

---
apiVersion: v1
kind: Service
metadata:
  annotations: {}
  name: rabbitmq-windows
  namespace: default
  resourceVersion: '167889'
spec:
  clusterIP: 10.106.113.144
  clusterIPs:
    - 10.106.113.144
  internalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  ports:
    - name: http
      port: 5672
      protocol: TCP
      targetPort: 5672
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

在这里插入图片描述

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐