Saturday, September 23, 2017

Bash Script to Build Kubernetes on LXD for Development Environment

LXD is cool
Docker is cool
Kubernetes is cool

Getting them to all play nice, not so easy.  Here's what I've done to make it happen all in one script run on the latest/greatest Ubuntu 16.04. You'll have to get interactive with the lxd init piece because --auto doesn't seem to do the trick for whatever reason.

This assumes you've configured LXD to your liking on the parent host.

Don't ask about the sleeps and the double installation of conjure-up, because I don't know why, it just works on my server. Feel free to suggest improvements.

2 Scripts

#1 echo_hosts.sh - A quick add of a self-referencing hosts entry for the parent container
-------------------
#!/bin/bash

echo `ip addr show |grep eth0 |grep inet|grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b\/24"|cut -d \/ -f1` "kubernetes" >> /etc/hosts
--------------------

#2 build_kubernetes_lxd.sh
---------------

#!/bin/bash
sudo sysctl fs.inotify.max_user_instances=1048576  
sudo sysctl fs.inotify.max_queued_events=1048576  
sudo sysctl fs.inotify.max_user_watches=1048576  
sudo sysctl vm.max_map_count=262144
lxc launch ubuntu:16.04 kubernetes -c security.privileged=true -c security.nesting=true -c linux.kernel_modules=ip_tables,ip6_tables,netlink_diag,nf_nat,overlay -c raw.lxc=lxc.aa_profile=unconfined
lxc config device add kubernetes mem unix-char path=/dev/mem
sleep 5
lxc exec kubernetes -- apt update
sleep 5
lxc exec kubernetes -- apt dist-upgrade -y
sleep 5
lxc exec kubernetes -- apt install squashfuse -y
sleep 20 
lxc exec kubernetes -- snap install conjure-up --classic 
sleep 5
lxc exec kubernetes -- snap install conjure-up --classic 
sleep 5
lxc exec kubernetes -- reboot
sleep 20
lxc exec kubernetes -- apt -y remove lxd
sleep 5
lxc exec kubernetes -- snap install lxd
sleep 10
lxc exec kubernetes -- /snap/bin/lxd init 
sleep 5
lxc file push echo_hosts.sh kubernetes/root/
lxc exec kubernetes -- chmod 770 ~/echo_hosts.sh
lxc exec kubernetes -- ~/echo_hosts.sh
lxc exec kubernetes -- sudo -u ubuntu -i /snap/bin/conjure-up kubernetes

--------------

Note: This script gets you through to the interactive conjure-up console. From there you choose the options of your choice and aim it at localhost (which should not be greyed out if all went well with the installer.) It's important that you use /snap/bin/lxc to see the nested kubernetes containers.  It's easy to forget, so might add a symlink to /usr/bin/ if it suites you.

Reference Sources:
https://insights.ubuntu.com/2017/02/20/running-kubernetes-inside-lxd/
https://insights.ubuntu.com/2016/11/21/conjure-up-canonical-kubernetes-under-lxd-today/

Monday, October 24, 2016

Why I'm Done With The Walking Dead - Warning Spoilers

Total opinion piece.  I (like many that haven't already bailed on the show) anxiously awaited the big reveal on Sunday night.  I watched the first head get bashed in...  and then the second head get bashed in....  And then...    Meh. I turned it off and I don't plan to watch it any more.

During the ridiculously long wait for this cliffhanger to resolve, I realized that I REALLY don't like where the writers are taking the show.  I'll admit I'm not a comic reader (in general or of TWD) so perhaps the writers of the comic are the one's to blame.  However, the experiences I've had with the show (while many positive) have been overshadowed by the hopelessness that the writers only continue to exaggerate.  I get the whole "life sux and then you die theme," but to be honest it's oversold in this series.  A storyline that interests people needs some hope in it, even if you're ultimately going to end that hope with a brainy splat.

Glen, in my mind, maintained the last vestige of hope out of all of the characters.  He still seemed to have a vision of a positive future, where the rest seem to have gone numb and just continue to walk around, from here to there, killing zombies and "bad guys" along the way.  The viewers issued as strong a warning as they could have ever given last season with the under-the-dumpster fiasco, but apparently the writers are either dense or just plain stubborn.  In either case this episode proved to me that there's no hope for this crew and collapsed any logic persisting in my mind that they will do anything other than continue to lose.  Who wants to watch otherwise strong and adept characters continue to flop around (like fish out of water) in a wasteland season after season with no hope of ever doing anything bigger?

Where is the story telling in that?  Where is a sub-plot that continues to explain the virus, where it originated, and ANY effort there might be to create a vaccine or an antidote? For me to watch the show, I need some sort of equitable reward for emotionally investing in the characters and the writers of the show just effectively dispatched any idea that that reward will ever exist.

TWD has lost its way. In exchange for good story telling we've been given a perpetual downward spiral marked with predictable cyclical kill-offs.  If humans were as nihilistic and hopeless as the characters left on TWD, we would have NEVER developed into a society and that reality flies in the face of the show's premise.  At this point I'll chalk this show up to a bold adventure into a new domain on TV and remove it from my favorites/DVR scheduling. It was kinda cool there for awhile at least...

Sunday, September 6, 2015

Yosemite sshd Config

I'm going to assume that as an experienced user of OSX you know how to navigate sudo and making changes to files. With that said

There are a slew of tutorials out there explaining how to change the port of sshd on Yosemite. Some of them are right, others are quite misleading. One of them (the first google result I got) even suggested adding a second process as ssh2. This is NOT what you want to do if you (like me) simply want to change port 22 to some other ephemeral port. I had gone through a few of these and even added the second process as recommended, using macports openssh. Make your life easier and don't do this. There are simply two files you must edit, that is all.

1. /System/Library/LaunchDaemons/ssh.plist
<string>ssh</string> <string>2222</string>

2. /private/etc/sshd_config
Port 2222 ListenAddress 123.456.789.012

Reload the process after you've edited these two files.
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist sudo launchctl load /System/Library/LaunchDaemons/ssh.plist

Saturday, September 5, 2015

Moon Over Escondido 2015



Admittedly, I'm not very good at this yet.  Took this of the "Super" Moon last week. I was able to create the animation and video in Photoshop, using the timeline window features.  I look forward to doing a better job next attempt.

Saturday, August 8, 2015

Hand Made Studio

In October of 2014 I embarked on a construction project to convert my small cellar into a fully functional (mini) recording studio. I have collected much of the audio gear over a long period of time and had it living in a more temporary setup in our den.

After a few complaints from the neighbors about the drums and an unsightly visit from the local authorities, I decided it was time to get serious about sound treatment/management.

It all started with me reading this book: Home Recording Studio - Build It Like The Pros, 2nd Edition  It was a quick and fascinating read, teaching me how to go about isolating the maddening levels that drums produce using (mostly) standard building materials.  I highly recommend reading this book if you intend to go down a similar path.

Containing the percussive explosion that is a snare hit is no joke.  While I'm quite content playing keyboards with my headphones, my drummer contingent is a different ball of wax altogether.  In the den, with my son playing the drums, we were seeing around 120db. Outside the room, we were seeing about 110db (as were the neighbors.)

So armed with a lot of new knowledge and a tiny army of family and friends, we embarked on a design and construction of a (room inside of a room) drum booth.

 First Step was to paint

Next came the carpet and a bit of mock-up to make sure things would fit okay
And then came the Framing and Electrical
Then the Drywall and Insulation.
This is where it gets fun.  For a standard room, you frame, insulate (or not,) drywall and you're done.  For a sound isolation booth, you frame, insulate, drywall, sound glue, drywall again, sound glue, and then add foam. The sound glue is not cheap. I did lots of homework and went the the less-expensive option called Quiet Glue Pro. It has worked out really well for me.



Completed Drum Booth. Now in the room (outside of the booth) we are seeing 75db and outside of the cellar 55db.   My son can play full blast in the middle of the night and you barely hear it inside the house. Outside the house it's practically inaudible. 

Then I got to work on the sound panels and desk following (and modifying) this design I found on Pinterest/Gearslutz.


Desk Build

I was inspired by this video for the sound panels 

After many many many hours of work on panels and the desk:



So I'm now busy putting this thing to good use.  I want to thank all of the industrious people that published their studio related work/ideas on the web.  You all definitely helped me see that I could do this.  Obviously Thanks goes out to my wife, children, and friends for all of their sweat and company throughout the build. 

Stay tuned here for the output. 



Monday, August 3, 2015

What processes on my machine are connected to the internet?

This is a one-liner that will tell you which processes on your host (mines a mac) that are connected to which ips by port.

for i in `netstat -aln |grep ESTABLISHED|sed 's/\ \ */,/g' |cut -d, -f5|cut -d. -f5|sort -u`;do lsof -i :$i ;done

Wednesday, July 29, 2015

First Post

I used to maintain a very similar blog, but it fell off of the priorities list. Re-upping this. My main intent is to share thoughts on tech, what's happening with it now, where I think it's going and all that jazz. Follow along if you will.