Skip to content
Snippets Groups Projects

OTC Create Service and Ingress

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Marius Politze
    Edited
    service.yml 1.27 KiB
    apiVersion: v1
    kind: Service
    metadata:  
      name: my-service
      labels:
        app: my-service
      namespace: default
      annotations: {}
    spec:
      selector:
        app: my-service
      externalTrafficPolicy: Cluster
      ports:
        - name: cce-service-0
          targetPort: 8080
          nodePort: 0
          port: 8080
          protocol: TCP
      type: NodePort
    ---
    apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    metadata:
      labels:
        zone: data
        isExternal: 'true'
      name: my-service
      namespace: default
      annotations:
        kubernetes.io/ingress.class: cce
        kubernetes.io/elb.port: '443'
        kubernetes.io/elb.ip: 80.158.59.13
        kubernetes.io/elb.id: b2ab4371-d81d-470c-b348-09fba34e1e85
    spec:
      rules:
        - http:
            paths:
              - backend:
                  serviceName: my-service
                  servicePort: 8080
                path: /my-service
                property:
                  ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH
          # Add a subdomain to the rule, has to resolve to `IP 80.158.59.13`
          # Working on getting a wildcard entry in place with TLS certificate
          # see below.
          #host: 'my-service.example.com'
    # For now use a self signed certificate. Working on getting a LetsEncrypt
    # wildcard in place with the respective domain.
      tls:
        - secretName: ssl-localhost-selfsigned
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment