Tuesday, September 3, 2019

Minikube TCP ingress

I've been playing around with Minikube to setup a local, single-node kubernetes cluster. But it wasn't obvious how to open a tcp to connect to a service running in the cluster.

1. Enable the minikube ingress addon. This installs a ingress-nginx controller for you in the kube-system namespace

minikube addons enable ingress

2. The ingress-nginx supports proxying tcp ports (see the docs for details), we jsut need to edit the configmap created by the minikube to forward the correct ports.

Here is an example adding tcp ingress from port 5432, to a default/postgres service on port 5432:


3. By default, the minikube ingress addon sets up ingres-nginx to use the internal network, so the ports are still not exposed to clients outside the cluster. One way around this is the change the ingress pod to use the host neowork, so the nginx listens of the host's network interface. The docs go over the pros and cons of using host ports, but it worked for my use case.

Enable host network for ingress controller:

Thursday, October 20, 2011

Remote Desktop via VNC in Ubuntu 11.10

Mark outlined a few remote desktop methods here.  The method that has worked for me is to use x11vnc with a simple script to start it when I want to connect:
$ cat ~/bin/start-vnc.sh
#!/bin/sh
x11vnc -nopw -once -display :0 > ~/.vnc.log 2>&1 &
Then the sequence of events is to start a session is:
  1. Connect to my pc via ssh (and tunnel the vnc port 5900)
  2. Run start-vnc.sh
  3. Connect with vnc client (I use UltraVnc - it seems to work well)
The -once flag tells x11vnc to exit after you've disconnected.

If you need to connect before anyone is logged into the system, you'll need to use the -auth option to provide the correct authentication for the login screen.   In Ubuntu 11.10 this seems to work:

sudo x11vnc -nopw -once -display :0 -auth /var/run/lightdm/root/:0



Tuesday, September 27, 2011

Show a change log after a pull in Mercurial

When working in a team on the same mercurial repository, I often want to know what has changed singe my last pull. Turns out its easy to add a hook that will do just that.  To print the change log after every pulladd the following to the [hooks] section of your ~/.hgrc file:
[hooks]
changegroup.cnglog=hg log -M --stat -r $HG_NODE:tip

But of course, bright colours are fun, so we'll use hg styles to colour-code the log. Steve Losh has a good blog article about using styles to dress up the CLI. After downloading the styles to say /home/bryan/hg/, update the trigger to use the style:
[hooks]
changegroup.cnglog=hg log -M --stat -r $HG_NODE:tip --style /home/bryan/hg/map-cmdline.slog


Sunday, September 18, 2011

Gmail's Priority Inbox: Showing all unarchived mail for a label

If you use Gmail's priority inbox, you may have noticed you can add a section that will show all email for a given label, but there is no option to only show mail in the inbox for that label. Luckily there's a simple hack to do just that. Check out this stackexchange thread or follow the steps below.

  1. Go to the priority inbox settings tab.
  2. Click the options next to the section you want to show your work mail.
  3. Click "More Options..."
  4. Inspect the element for the "Work" Label
  5. You will notice on the surrounding div there is an attribute cfg="^all,Work", change the value to "^i,Work"
  6. Select the label on the page as you normally would