Sunday, November 10, 2019

NGINX Ingress Controller

I’m using the kubernetes main documentation for this. I’ve got a couple of deployments that have installed their own nginx. I’m thinking I just want one for everything so here we go.

This is the basic install

helm install stable/nginx-ingress --name deepthot-nginx --namespace ingress-nginx --set rbac.create=true

Configuration

Dashboard

Let’s get it working for the dashboard. I want it at deepthot.aa/dashboard. First set up the dashboard

 helm upgrade  --install dashboard stable/kubernetes-dashboard \
 --namespace dashboard  \
 --set enableSkipLogin=true \
 --set enableInsecureLogin=true \
 --set ingress.enabled=true

And there it is. This created a dashboard at http(s)://192.168.42.65 Not quite what we wanted, but progress. Let’s see what it takes to move it to /dashboard.

{
  "kind": "Ingress",
  "apiVersion": "extensions/v1beta1",
  "metadata": {
    "name": "dashboard-kubernetes-dashboard",
    "namespace": "dashboard",
    "selfLink": "/apis/extensions/v1beta1/namespaces/dashboard/ingresses/dashboard-kubernetes-dashboard",
    "uid": "69dbf23d-e2c5-44e5-9519-b2f3cc48a0d2",
    "resourceVersion": "2241749",
    "generation": 6,
    "creationTimestamp": "2019-11-09T15:12:35Z",
    "labels": {
      "app": "kubernetes-dashboard",
      "chart": "kubernetes-dashboard-1.10.0",
      "heritage": "Tiller",
      "release": "dashboard"
    }
  },
  "spec": {
    "rules": [
      {
        "http": {
          "paths": [
            {
              "path": "/",
              "backend": {
                "serviceName": "dashboard-kubernetes-dashboard",
                "servicePort": 443
              }
            }
          ]
        }
      }
    ]
  },
  "status": {
    "loadBalancer": {
      "ingress": [
        {}
      ]
    }
  }
}

I was trying to pass everything on the command line, but the array of annotations escaped my abilities. Anyway, here is the command: helm upgrade --install dashboard stable/kubernetes-dashboard --namespace dashboard -f kubernetes-dashboard/values.yaml and the values file:

ingress:
  enabled: true
  paths:
    - '/dashboard(.*)'
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: $1
enableSkipLogin: true
enableInsecureLogin: true

However after going through all it took to get here (yes, I’m a foolish girl). I’m thinking wtf do I want it at deepthot.aa/dashboard? dashboard.deepthot.aa will let me just enter dashboard on the url in the web browser.
Here’s the revised yaml

ingress:  
  enabled: true  
  hosts:  
    - dashboard.deepthot.aa  
    - dashboard  
enableSkipLogin: true  
enableInsecureLogin: true

Notice I can list the hosts. For instance I could have one ingress make both the public and local DNS work.
Speaking of local DNS, I also needed to ipa dnsrecord-add deepthot.aa dashboard --cname-hostname @ Note that I’m referring to ‘@’, I also made a record for the site itself ipa dnsrecord-add --a-ip-address=192.168.42.50 deepthot.aa @

gitlab

So, after all that effort to get gitlab running I’m going to undo all of the ingress stuff in gitlab and put it into my site. Turns out this is really easy.

  1. Aim the site at gitlab turning off the old ingress
  2. Update DNS
  3. Set up the mapping for the ssh interface

Aim the site at gitlab turning off the old ingress

Basically it’s just this: helm upgrade --install -f values.yaml --namespace gitlab gitlab gitlab/gitlab --set nginx-ingress.enabled=false Don’t forget to edit the values.yaml file to reflect this.

Update the DNS

ipa dnsrecord-del  deepthot.aa gitlab --a-rec 192.168.42.64
ipa dnsrecord-del  deepthot.aa minio --a-rec 192.168.42.64
ipa dnsrecord-del  deepthot.aa registry --a-rec 192.168.42.64
ipa dnsrecord-add deepthot.aa gitlab --cname-hostname @
ipa dnsrecord-add deepthot.aa minio --cname-hostname @
ipa dnsrecord-add deepthot.aa registry --cname-hostname @

Just remove the old records and replace with the new. This will allow me to easily switch all of the services by just changing the record for deepthot.aa (the @ above)

Set up the mapping for the ssh interface

helm upgrade --install deepthot-nginx stable/nginx-ingress --namespace ingress-nginx --set rbac.create=true --set tcp.22="gitlab/gitlab-gitlab-shell:22"
I don’t have a values.yaml, I probably should even though there’s not much to these commands. Going to do that right now.

No comments:

Post a Comment

How Simple Does It Have to Be Before It’s Mine?

 Hi, Joy here, I'm tired.  I'm too tired to polish this.  However bare with me, the text below is *trying* to be me.  It's not l...