我的入口控制器找不到我的服务

时间:2018-12-02 15:24:05

标签: kubernetes kubernetes-ingress nginx-ingress

我的入口控制器日志显示以下内容

I1202 14:58:17.685844       6 event.go:218] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"sud", Name:"ingress", UID:"7e932e17-f642-11e8-92d8-000d3a2cc488", APIVersion:"extensions", ResourceVersion:"50157622", FieldPath:""}): type: 'Normal' reason: 'DELETE' Ingress sud/ingress
I1202 14:58:17.686399       6 controller.go:168] backend reload required
I1202 14:58:17.834844       6 controller.go:177] ingress backend successfully reloaded...
I1202 14:58:31.164810       6 event.go:218] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"sud", Name:"ingress", UID:"bbab476f-f642-11e8-92d8-000d3a2cc488", APIVersion:"extensions", ResourceVersion:"50157762", FieldPath:""}): type: 'Normal' reason: 'CREATE' Ingress sud/ingress
I1202 14:58:31.166468       6 backend_ssl.go:69] adding secret sud/erst-tls-secret to the local store
I1202 14:58:31.167547       6 controller.go:168] backend reload required
I1202 14:58:31.305946       6 controller.go:177] ingress backend successfully reloaded...
W1202 14:58:39.246836       6 controller.go:700] error obtaining service endpoints: error getting service sud/sud-app from the cache: service sud/sud-app was not found
I1202 14:58:39.247286       6 controller.go:168] backend reload required
I1202 14:58:39.404124       6 controller.go:177] ingress backend successfully reloaded...
I1202 14:58:47.549709       6 backend_ssl.go:181] updating local copy of ssl certificate sud/erst-tls-secret with missing intermediate CA certs
W1202 14:58:47.550274       6 controller.go:700] error obtaining service endpoints: error getting service sud/sud-app from the cache: service sud/sud-app was not found
W1202 14:58:50.883756       6 controller.go:773] service sud/sud-app does not have any active endpoints
I1202 14:58:50.883925       6 controller.go:168] backend reload required
I1202 14:58:51.016857       6 controller.go:177] ingress backend successfully reloaded...
W1202 14:58:54.217091       6 controller.go:773] service sud/sud-app does not have any active endpoints
I1202 14:59:03.133269       6 controller.go:168] backend reload required
I1202 14:59:03.282312       6 controller.go:177] ingress backend successfully reloaded...
I1202 14:59:15.145734       6 status.go:361] updating Ingress sud/ingress status to [{52.166.72.191 }]
I1202 14:59:15.171198       6 event.go:218] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"sud", Name:"ingress", UID:"bbab476f-f642-11e8-92d8-000d3a2cc488", APIVersion:"extensions", ResourceVersion:"50157884", FieldPath:""}): type: 'Normal' reason: 'UPDATE' Ingress sud/ingress
37.49.142.33 - [37.49.142.33] - - [02/Dec/2018:14:59:48 +0000] "GET /sud HTTP/2.0" 404 249 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36" 282 0.066 [sud-sud-app-8080] 10.244.0.110:8080 306 0.068 404 3b0c156b82285416b43d591c3ba95495

我的入口

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress
  labels:
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
  rules:
  - host: {{ .Values.host.name }}
    http:
      paths:
      - path: /
        backend:
          serviceName: sud-app
          servicePort: 8080
  tls:
  - hosts:
    - {{ .Values.host.name }}
    secretName: erst-tls-secret

我的服务

apiVersion: v1
kind: Service
metadata:
  name: {{ include "sud-app.fullname" . }}
  labels:
    app: sud-app
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app: sud-app

我的部署

apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: {{ include "sud-app.fullname" . }}
  labels:
    app: sud-app
    name: sud-app
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: sud-app
      name: sud-app
  template:
    metadata:
      labels:
        app: sud-app
        name: sud-app
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}

获取服务的输出

$ kubectl-1.10.0 --context ml-dev get services -n sud
NAME      TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
sud-app   ClusterIP   10.0.58.62   <none>        8080/TCP   44m

关于我在做什么错的任何想法吗?

0 个答案:

没有答案