通过大使访问kubernetes无头服务

时间:2019-05-20 15:57:13

标签: kubernetes headless envoyproxy

我已将我的服务部署为无头服务器,并且确实遵循了此链接(http://vertx.io/docs/vertx-hazelcast/java/#_using_this_cluster_manager)中所述的kubernetes配置。我的服务是负载平衡的,并使用大使进行代理。只要服务不是没有问题,一切都可以正常工作。服务变为无头后,大使将无法发现我的服务。这意味着它一直在寻找clusterIP,但由于该服务是无头的,现在已经不见了。我需要在我的deployment.yaml中包括什么,以便使大使发现这些服务。

错误我看到“上游连接错误或在标头之前断开连接/重置。重置原因:连接失败”

我需要这些服务没有头绪,因为这是使用hazelcast创建集群的唯一方法。我正在创建Web套接字连接和vertx eventbus。


apiVersion: v1
kind: Service
metadata:
  name: abt-login-service
  labels:
    chart: "abt-login-service-0.1.0-SNAPSHOT"
  annotations:
    fabric8.io/expose: "true"
    fabric8.io/ingress.annotations: 'kubernetes.io/ingress.class: nginx'

    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      name:  login_mapping
      ambassador_id: default
      kind: Mapping
      prefix: /login/
      service: abt-login-service.default.svc.cluster.local
      use_websocket: true
spec:
  type: ClusterIP
  clusterIP: None
  selector:
    app: RELEASE-NAME-abt-login-service
  ports:
  - port: 80
    targetPort: 8080
    protocol: TCP
    name: http
  - name: hz-port-name
    port: 5701
    protocol: TCP```


```Deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: RELEASE-NAME-abt-login-service
  labels:
    draft: draft-app
    chart: "abt-login-service-0.1.0-SNAPSHOT"
spec:
  replicas: 2
  selector:
    matchLabels:
     app: RELEASE-NAME-abt-login-service
  minReadySeconds: 30
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        draft: draft-app
        app: RELEASE-NAME-abt-login-service
        component: abt-login-service
    spec:
      serviceAccountName: vault-auth
      containers:
      - name: abt-login-service
        env:
        - name: SPRING_PROFILES_ACTIVE
          value:  "dev"
        - name: _JAVA_OPTIONS
          value:  "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=2 -Dsun.zip.disableMemoryMapping=true -XX:+UseParallelGC -XX:Min
HeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dhazelcast.diagnostics.enabled=true
"
        image: "draft:dev"
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8080
        ports:
        - containerPort: 5701
        livenessProbe:
          httpGet:
            path: /health
            port: 8080
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        readinessProbe:
          httpGet:
            path: /health
            port: 8080
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources:
            limits:
              cpu: 500m
              memory: 1024Mi
            requests:
              cpu: 400m
              memory: 512Mi

      terminationGracePeriodSeconds: 10```

How can I make these services discoverable by ambassador?

0 个答案:

没有答案