kubernetes Centos7盒子上的nginx入口控制器设置

时间:2019-02-06 01:03:27

标签: nginx kubernetes nginx-ingress

我正在根据此博客设置Nginx Ingress控制器 https://akomljen.com/kubernetes-nginx-ingress-controller/。但是我无法在端口80处卷曲Nginx。

我能够通过暴露的节点端口访问默认后端,并且nginx日志没有显示错误。

这是我的控制器配置:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx-ingress-controller
spec:
  replicas: 1
  revisionHistoryLimit: 3
  template:
    metadata:
      labels:
        app: nginx-ingress-controller
    spec:
      terminationGracePeriodSeconds: 60
      serviceAccount: nginx
      containers:
        - name: nginx-ingress-controller
          image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.12.0

          imagePullPolicy: Always
          readinessProbe:
            httpGet:
              path: /healthz
              port: 10254
              scheme: HTTP
          livenessProbe:
            httpGet:
              path: /healthz
              port: 10254
              scheme: HTTP
            initialDelaySeconds: 10
            timeoutSeconds: 5
          args:
            - /nginx-ingress-controller
            - --default-backend-service=$(POD_NAMESPACE)/default-http-backend
            - --configmap=$(POD_NAMESPACE)/nginx-ingress-controller-conf
            - --v=2
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          ports:
            - containerPort: 80
            - containerPort: 18080

这是我的nginx服务:

apiVersion: v1
kind: Service
metadata:
  name: nginx-ingress
spec:
  type: NodePort
  ports:
  - name: http
    port: 80
    nodePort: 30000
    targetPort: http
  - name: https
    port: 443
    nodePort: 30043
    targetPort: https
  selector:
    app: nginx-ingress-controllere

0 个答案:

没有答案