更新时间:2024-04-23 GMT+08:00
分享

Eureka部署

导入镜像

上传编译arm版本的镜像deploy.deepexi.com/daas/arm/deepexi-daas-eureka-server:2.7.x.20210817_arm,安装到服务器,然后导入镜像

deepexi-daas-eureka- server:2.7.x.20210817_arm

图1 导入镜像

创建Eureka集群

  1. 通过k8s创建,上传eureka-pro.yaml文件到k8s master,然后执行:
    # kubectl create -f eureka-pro.yaml
    图2 执行1
    # kubectl -n applife get pods,ep,svc | grep eureka
    图3 执行2
  2. 看到上面提示/结果,表示创建成功。

    附:eureka.yaml文件内容

    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
    name: deepexi-daas-eureka-server
    namespace: applife
    labels:
    app: deepexi-daas-eureka-server
    spec:
    serviceName: deepexi-daas-eureka-server
    replicas: 3
    podManagementPolicy: "Parallel"
    selector:
    matchLabels:
    app: deepexi-daas-eureka-server
    template:
    metadata:
    namespace: applife
    labels:
    app: deepexi-daas-eureka-server
    openkube.deepexi.cloud/logtype: java
    spec:
    containers:
    - name: deepexi-daas-eureka-server
    imagePullPolicy: Always
    image: deploy.deepexi.com/daas/arm/deepexi-daas-eureka-server:2.7.x.20210817_arm
    command: ["/bin/sh","-c","java -Djava.security.egd=file:/dev/./urandom -Duser.timezone=Asia/Shanghai -Denv=DEV  -XX:+HeapDumpOnOutOfMemoryError -jar /home/demo.jar --spring.security.user.name=admin --spring.security.user.password=deepexi --server.port=8761 --eureka.client.register-with-eureka=true --eureka.client.fetch-registry=true --eureka.client.serviceUrl.defaultZone=http://admin:deepexi@deepexi-daas-eureka-server-0.deepexi-daas-eureka-server.applife.svc.cluster.local:8761/eureka/,http://admin:deepexi@deepexi-daas-eureka-server-1.deepexi-daas-eureka-server.applife.svc.cluster.local:8761/eureka/,http://admin:deepexi@deepexi-daas-eureka-server-2.deepexi-daas-eureka-server.applife.svc.cluster.local:8761/eureka/ --eureka.instance.hostname=$MY_POD_NAME.$MY_IN_SERVICE_NAME.$MY_POD_NAMESPACE.$MY_K8S_DNS_NAME"]
    env:
    - name: TZ
    value: Asia/Shanghai
    - name: MY_K8S_DNS_NAME
    value: svc.cluster.local
    - name: MY_IN_SERVICE_NAME
    value: deepexi-daas-eureka-server
    - name: MY_NODE_NAME
    valueFrom:
    fieldRef:
    fieldPath: spec.nodeName
    - name: MY_POD_NAME
    valueFrom:
    fieldRef:
    fieldPath: metadata.name
    - name: MY_POD_NAMESPACE
    valueFrom:
    fieldRef:
    fieldPath: metadata.namespace
    - name: MY_POD_IP
    valueFrom:
    fieldRef:
    fieldPath: status.podIP
    #volumeMounts:
    #- name: nfs-pvc
    #mountPath: "/etc/daas/kerberos"
    #volumes:
    #- name: nfs-pvc
    #persistentVolumeClaim:
    #claimName: daas-claim
    ---
    apiVersion: v1
    kind: Service
    metadata:
    name: deepexi-daas-eureka-server
    namespace: applife
    labels:
    app: deepexi-daas-eureka-server
    spec:
    type: ClusterIP
    ports:
    - port: 8761
    targetPort: 8761
    name: http
    protocol: TCP
    selector:
    app: deepexi-daas-eureka-server
    ---
    apiVersion: v1
    kind: Service
    metadata:
    name: deepexi-daas-eureka-server-nodeport
    namespace: applife
    labels:
    app: deepexi-daas-eureka-server
    spec:
    type: NodePort
    ports:
    - port: 8761
    nodePort: 38761
    name: http
    protocol: TCP
    targetPort: 8761
    selector:
    app: deepexi-daas-eureka-server

相关文档