Skip to content

Instantly share code, notes, and snippets.

@yijia2413 yijia2413/README.md
Last active Mar 4, 2019

Embed
What would you like to do?
K8S Config

Config Ingress Nginx

  • mandatory.yml, do not use hostNetwork, # hostNetwork: true
  • cloud-generic.yml, add externalIPs
    kind: Service
    apiVersion: v1
    metadata:
      name: ingress-nginx
      namespace: ingress-nginx
      labels:
        app.kubernetes.io/name: ingress-nginx
        app.kubernetes.io/part-of: ingress-nginx
    spec:
      externalTrafficPolicy: Local
      type: LoadBalancer
      externalIPs:
      - 172.28.128.3
      - 172.28.128.4
      - 172.28.128.5
      selector:
        app.kubernetes.io/name: ingress-nginx
        app.kubernetes.io/part-of: ingress-nginx
      ports:
        - name: http
          port: 80
          targetPort: http
        - name: https
          port: 443
          targetPort: https
    
    ---
    
    
  • Config pods
  kind: Pod
  apiVersion: v1
  metadata:
    name: py-app
    labels:
      app: pyserver
  spec:
    containers:
      - name: py-app
        image: your_registry/test/pyserver

  ---

  kind: Service
  apiVersion: v1
  metadata:
    name: py-service
  spec:
    selector:
      app: pyserver
    ports:
      - port: 30003

  • Config Ingress Service
  apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: py-ingress
    annotations:
      nginx.ingress.kubernetes.io/rewrite-target: /
      nginx.ingress.kubernetes.io/ssl-redirect: "false"
  spec:
    rules:
    #- host: py.test.com 
    - http:
        paths:
          - path: /py/
            backend:
              serviceName: py-service
              servicePort: 30003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.