automation, kubernetes-dedicated, linux, packet.net

Kubernetes, Helm and RancherOS

What is Helm?

Helm is the package manager for Kubernetes.

Helm is divided into two parts, the Helm Client (client) and Tiller Server (server)

Why do I need Helm?

To exemplify why do I need helm, I will tell you:

How my life was before Helm:

In order to get any kubernetes apps up and running, I had to:

  • Write Kubernetes manifests by hand
  • Do this everytime I wanted to release anything
  • Figure out how to deal with sharing this with other team members
  • Tweak all the resources by hand
  • Use kubectl to manage it

 

How is my life now with Helm:

  • Installing resources with kubernetes is now easy like apt-get, yum, homebrew … etc
  • My team is now able to colaborate, sharing helm charts on our internal repositories
  • Releases are reproducible across all environments (develop, accept and production)
  • Packages are now sharable

 

 

  • Charts: A bundle of kubernetes resource data, it operates the System Package
  • Repository: A collection of release charts, something like NPM, or Ubuntu Repository.
  • Release: A chart instance that was loaded into Kubernetes. If the same chart is installed several times inside the same cluster, each time the cart will have its own release.

 

Installing Helm on RancherOS

If you are trying to install Helm on RancherOS, chances are that you are now running into the problem that RancherOS does not come with cURL installed.

[rancher@kubernetes1 ~]$ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
-bash: curl: command not found

Due to the fact that Helm uses cURL to download its dependencies, please follow up How to install cURL on RancherOS

 

Download Helm executable script:

[root@kubernetes1 ~]# curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5962 100 5962 0 0 47711 0 –:–:– –:–:– –:–:– 55203

 

Add the chmod to the executable file:

[root@kubernetes1 ~]# chmod 700 get_helm.sh

Install Helm:

[root@kubernetes1 ~]# ./get_helm.sh

Happy Helming

 

 

automation, docker, kubernetes-dedicated, linux, rancher server, rancheros

How to install Rancher Server on RancherOS

How to install Rancher Server on RancherOS ?

If you are playing with RancherOS, chances are that you are stuck trying to figure out how to get the Rancher Server (Web UI) up and running after your fresh RancherOS installation.

Why RancherOS?

With RancherOS,  your server runs on a System Docker as the first process the kernel starts.

The System Docker replaces systemd, thus allowing RancherOS to manage all system services as Docker containers.

 

In order to get started on it, I’ve created this little guide for my own reference, I hope it helps:

 

Installing Rancher Server on RancherOS with Docker

 

$ sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
Unable to find image 'rancher/server:latest' locally
latest: Pulling from rancher/server

6599cadaf950: Pull complete 
23eda618d451: Pull complete 
f0be3084efe9: Pull complete 
52de432f084b: Pull complete 
a3ed95caeb02: Pull complete 
e75cd91a1dc5: Pull complete 
997f1b48f59f: Pull complete 
313c28fb4e37: Pull complete 
2a0730d1275c: Pull complete 
8848fbebd2c8: Pull complete 
bf44fc918d8d: Pull complete 
294d2b8ef44a: Pull complete 
8ef53e786a1e: Pull complete 
c66f5c1af2aa: Pull complete 
21a529f5f5c5: Pull complete 
e0b120915e7e: Pull complete 
1ce569657333: Pull complete 
a21d853ef921: Pull complete 
d11646728ac8: Pull complete 
Digest: sha256:59dba13b5cc1f50bbeb9127ed77cc5e72674e80f92dc0a22905a5df9372af464
Status: Downloaded newer image for rancher/server:latest
8064ddc60d59db1f4609f75cf425ab4e02e5dec08604014c1258195b398c3441


Check that the docker instance of rancher is up and running:

[rancher@kubernetes1 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8064ddc60d59 rancher/server "/usr/bin/entry /usr/" About a minute ago Up About a minute 3306/tcp, 0.0.0.0:8080->8080/tcp hungry_roentgen



Installing Rancher Agent on RancherOS with Docker
[rancher@kubernetes1 ~]$ sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://147.75.81.119:8080/v1/scripts/59ADA64CAB0BC3410D4F:1483142400000:8Fxhl6E5HlVEIqLQmfrqKWG9V8c
Unable to find image 'rancher/agent:v1.2.2' locally
v1.2.2: Pulling from rancher/agent
b3e1c725a85f: Pull complete 
4daad8bdde31: Pull complete 
63fe8c0068a8: Pull complete 
4a70713c436f: Pull complete 
bd842a2105a8: Pull complete 
3f7d6fd71888: Pull complete 
16914729cfd3: Pull complete 
b9c91512c230: Pull complete 
Digest: sha256:cfb7fc0de1146680ca26e3bc8cd09cc7a0274eff99f5b84246c33642a99f81da
Status: Downloaded newer image for rancher/agent:v1.2.2

INFO: Running Agent Registration Process, CATTLE_URL=http://147.75.81.220:8080/v1
INFO: Attempting to connect to: http://147.75.81.220:8080/v1
INFO: http://147.75.81.220:8080/v1 is accessible
INFO: Inspecting host capabilities
INFO: Boot2Docker: false
INFO: Host writable: true
INFO: Token: xxxxxxxx
INFO: Running registration
INFO: Printing Environment
INFO: ENV: CATTLE_ACCESS_KEY=4DF30CB1CA8A0B6B4251
INFO: ENV: CATTLE_HOME=/var/lib/cattle
INFO: ENV: CATTLE_REGISTRATION_ACCESS_KEY=registrationToken
INFO: ENV: CATTLE_REGISTRATION_SECRET_KEY=xxxxxxx
INFO: ENV: CATTLE_SECRET_KEY=xxxxxxx
INFO: ENV: CATTLE_URL=http://147.75.81.220:8080/v1
INFO: ENV: DETECTED_CATTLE_AGENT_IP=172.17.0.1
INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.2
INFO: Launched Rancher Agent: ca73dede34008Installing Rancher Agent on RancherOS92f9203b1b45a9c3228d267cd2f723b105805c5dfa25170373e


You can now access your Rancher Server on the provided IP address, on my case (eg: http://147.75.81.220:8080/v1)

kubernetes-dedicated, linux, ubuntu

Your dedicated Kubernetes cluster on Ubuntu with Kubeadm

Hi,

I’m not the best fan of Google documentation, in fact if there is something that they are very bad at, (besides interviewing people) is documenting things. But look, they are not the only ones, long before Google joined the battle against AWS, I had to read all the Amazon documentation, in fact I had to hate myself, my job and my life for long nights. During that period, I learned about EC2, AWS auto-scaling, puppet, cheff, ansible scripts, capistrano scripts …. oh how many nights I spent reading that docs ?

Honestly, I’ve spend so much time reading docs and watching people talking about Kubernetes, but besides Kelsey Hightower (When he was working for CoreOS) no other speaker was able to really DEMO kubernetes cluster on bare-metal and really make it happen. The main problem at least for me, was after the conference, you get your notebook, your favorite dedicated server provider (OVH ? ) and try yourself… but, well … it does not work.

I just want to move one to something better, I just want to get the job done and be able to focus on programming awesome software … Finally this day is a little closer now.

 

Easy to follow step by step tutorial

Out of my frustration I decided it was time to do some easy to follow step by step tutorial.

Seriously, I don’t have much time to loose, and I want to get my own Kubernetes cluster on bare metal / dedicated server, why is this So complicated ??

I’ve been trying to do this for at least 1 year, release after release of Kubernetes, CoreOS, RancherOS … always hitting the same spot … and always ending up in a dead end with some freak problem that makes me hate myself, hate Docker and kubernetes all together.

 

This week, I had a pleasant experience and so I decided it was about time to share it with the others, please bare in mind that Kubeadm is alpha and something may not work. (You have been Advised.)

 

Kubernetes Dedicated Bare-Metal Cluster on Ubuntu with Kubeadm

Today I will be teaching you to create your own Kubernetes cluster, OUTSIDE Google Cloud. 

Don’t get me wrong Google people, but I just like to explore the world and be able to have a dedicated server, without having to pay so much money for it. Because in the end, this is OpenSource software and we are living in a Free world.

 

 

So, for this tutorial we will be using 3 servers with Ubuntu 16.04, so please have it ready before starting. You can use any cloud provider that you want. I’m using DigitalOcean or Packet.net because they accept paypal and they have descent pricing, but feel free to chose anything you like better.

 

Installing required sources for Kubernetes on Ubuntu 16.06

First thing is to update your apt-get and install transport-https in order to be able to download the right resources via https:

apt-get update && apt-get install -y apt-transport-https

(...)

Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
 Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
 Get:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
 Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [544 kB]
 Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [220 kB]
 Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [469 kB]
 Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [185 kB]
 Get:8 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [268 kB]
 Get:9 http://archive.ubuntu.com/ubuntu xenial-security/main Translation-en [113 kB]
 Get:10 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [115 kB]
 Get:11 http://archive.ubuntu.com/ubuntu xenial-security/universe Translation-en [59.8 kB]
 Fetched 2177 kB in 1s (1723 kB/s)
 Reading package lists... Done
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 The following NEW packages will be installed:
 apt-transport-https
 0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
 Need to get 26.1 kB of archives.
 After this operation, 214 kB of additional disk space will be used.
 Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apt-transport-https amd64 1.2.20 [26.1 kB](...)
 Fetched 26.1 kB in 0s (887 kB/s)
 perl: warning: Setting locale failed.
 perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LC_TIME = "nl_NL.UTF-8",
 LC_MONETARY = "nl_NL.UTF-8",
 LC_ADDRESS = "nl_NL.UTF-8",
 LC_TELEPHONE = "nl_NL.UTF-8",
 LC_NAME = "nl_NL.UTF-8",
 LC_MEASUREMENT = "nl_NL.UTF-8",
 LC_IDENTIFICATION = "nl_NL.UTF-8",
 LC_NUMERIC = "nl_NL.UTF-8",
 LC_PAPER = "nl_NL.UTF-8",
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
 perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
 debconf: unable to initialize frontend: Dialog
 debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
 debconf: falling back to frontend: Readline
 Selecting previously unselected package apt-transport-https.
 (Reading database ... 23775 files and directories currently installed.)
 Preparing to unpack .../apt-transport-https_1.2.20_amd64.deb ...
 Unpacking apt-transport-https (1.2.20) ...
 Setting up apt-transport-https (1.2.20) ...

 

The next step is to add the google cloud keys to your Ubuntu installation in order to be able to authenticate and download the packages using the right key:

root@kubernetes-1:~# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
 OK

Now we will add the kubernetes Ubuntu sources into the /etc/apt/sources.list.d/kubernetes.list so apt-get knows where to find what we are looking for:

 
root@kubernetes-1:~# cat <<EOF >/etc/apt/sources.list.d/kubernetes.list \
deb http://apt.kubernetes.io/ kubernetes-xenial main \
EOF

 

Running some Updates

After updating your sources list, you need to tell Ubuntu: Hey please update yourself and be ready because we will be doing alpha crazy stuff over here, next we will install Docker.

 root@kubernetes-1:~# apt-get update
 Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
 Hit:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
 Hit:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease
 Get:4 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8936 B]
 Get:5 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [3472 B]
 Fetched 12.4 kB in 1s (8232 B/s)
 Reading package lists... Done

What is Docker:

Docker is an additional layer of abstraction and automation of operating-system-level virtualization on Windows and Linux.[6] Docker uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others[7] to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines.[8]  – Wikipidia

 

Docker-linux-interfaces.svg

Installing Docker:

 
 root@kubernetes-1:~# apt-get install -y docker-engine
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 The following additional packages will be installed:
 apparmor aufs-tools cgroupfs-mount git git-man libapparmor-perl liberror-perl libltdl7 patch
 Suggested packages:
 apparmor-profiles apparmor-profiles-extra apparmor-docs apparmor-utils mountall git-daemon-run
 | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn ed
 diffutils-doc
 The following NEW packages will be installed:
 apparmor aufs-tools cgroupfs-mount docker-engine git git-man libapparmor-perl liberror-perl libltdl7 patch
 0 upgraded, 10 newly installed, 0 to remove and 11 not upgraded.
 Need to get 19.0 MB of archives.
 After this operation, 102 MB of additional disk space will be used.
 Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libapparmor-perl amd64 2.10.95-0ubuntu2.6 [31.4 kB]
 Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apparmor amd64 2.10.95-0ubuntu2.6 [450 kB]
 Get:3 http://archive.ubuntu.com/ubuntu xenial/universe amd64 aufs-tools amd64 1:3.2+20130722-1.1ubuntu1 [92.9 kB]
 Get:4 http://archive.ubuntu.com/ubuntu xenial/universe amd64 cgroupfs-mount all 1.2 [4970 B]
 Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 libltdl7 amd64 2.4.6-0.1 [38.3 kB]
 Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
 Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 git-man all 1:2.7.4-0ubuntu1.1 [735 kB]
 Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 git amd64 1:2.7.4-0ubuntu1.1 [3068 kB]
 Get:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 patch amd64 2.7.5-1 [90.4 kB]
 Get:9 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 docker-engine amd64 1.11.2-0~xenial [14.5 MB]
 Fetched 19.0 MB in 3s (5102 kB/s)
 perl: warning: Setting locale failed.
 perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LC_TIME = "nl_NL.UTF-8",
 LC_MONETARY = "nl_NL.UTF-8",
 LC_ADDRESS = "nl_NL.UTF-8",
 LC_TELEPHONE = "nl_NL.UTF-8",
 LC_NAME = "nl_NL.UTF-8",
 LC_MEASUREMENT = "nl_NL.UTF-8",
 LC_IDENTIFICATION = "nl_NL.UTF-8",
 LC_NUMERIC = "nl_NL.UTF-8",
 LC_PAPER = "nl_NL.UTF-8",
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
 perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
 debconf: unable to initialize frontend: Dialog
 debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 10.)
 debconf: falling back to frontend: Readline
 Preconfiguring packages ...
 Selecting previously unselected package libapparmor-perl.
 (Reading database ... 23781 files and directories currently installed.)
 Preparing to unpack .../libapparmor-perl_2.10.95-0ubuntu2.6_amd64.deb ...
 Unpacking libapparmor-perl (2.10.95-0ubuntu2.6) ...
 Selecting previously unselected package apparmor.
 Preparing to unpack .../apparmor_2.10.95-0ubuntu2.6_amd64.deb ...
 Unpacking apparmor (2.10.95-0ubuntu2.6) ...
 Selecting previously unselected package aufs-tools.
 Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ...
 Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
 Selecting previously unselected package cgroupfs-mount.
 Preparing to unpack .../cgroupfs-mount_1.2_all.deb ...
 Unpacking cgroupfs-mount (1.2) ...
 Selecting previously unselected package libltdl7:amd64.
 Preparing to unpack .../libltdl7_2.4.6-0.1_amd64.deb ...
 Unpacking libltdl7:amd64 (2.4.6-0.1) ...
 Selecting previously unselected package docker-engine.
 Preparing to unpack .../docker-engine_1.11.2-0~xenial_amd64.deb ...
 Unpacking docker-engine (1.11.2-0~xenial) ...
 Selecting previously unselected package liberror-perl.
 Preparing to unpack .../liberror-perl_0.17-1.2_all.deb ...
 Unpacking liberror-perl (0.17-1.2) ...
 Selecting previously unselected package git-man.
 Preparing to unpack .../git-man_1%3a2.7.4-0ubuntu1.1_all.deb ...
 Unpacking git-man (1:2.7.4-0ubuntu1.1) ...
 Selecting previously unselected package git.
 Preparing to unpack .../git_1%3a2.7.4-0ubuntu1.1_amd64.deb ...
 Unpacking git (1:2.7.4-0ubuntu1.1) ...
 Selecting previously unselected package patch.
 Preparing to unpack .../patch_2.7.5-1_amd64.deb ...
 Unpacking patch (2.7.5-1) ...
 Processing triggers for systemd (229-4ubuntu17) ...
 Processing triggers for man-db (2.7.5-1) ...
 Processing triggers for libc-bin (2.23-0ubuntu7) ...
 Setting up libapparmor-perl (2.10.95-0ubuntu2.6) ...
 Setting up apparmor (2.10.95-0ubuntu2.6) ...
 debconf: unable to initialize frontend: Dialog
 debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
 debconf: falling back to frontend: Readline
 update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
 insserv: can not symlink(../init.d/halt, ../rc0.d/K11halt): File exists
 insserv: can not symlink(../init.d/halt, ../rc0.d/K11halt): File exists
 insserv: can not symlink(../init.d/sendsigs, ../rc0.d/K04sendsigs): File exists
 insserv: can not symlink(../init.d/sendsigs, ../rc0.d/K04sendsigs): File exists
 insserv: can not symlink(../init.d/umountnfs.sh, ../rc0.d/K06umountnfs.sh): File exists
 insserv: can not symlink(../init.d/umountnfs.sh, ../rc0.d/K06umountnfs.sh): File exists
 insserv: can not symlink(../init.d/iscsid, ../rc0.d/K03iscsid): File exists
 insserv: can not symlink(../init.d/networking, ../rc0.d/K07networking): File exists
 insserv: can not symlink(../init.d/umountfs, ../rc0.d/K08umountfs): File exists
 insserv: can not symlink(../init.d/umountfs, ../rc0.d/K08umountfs): File exists
 insserv: can not symlink(../init.d/umountroot, ../rc0.d/K09umountroot): File exists
 insserv: can not symlink(../init.d/umountroot, ../rc0.d/K09umountroot): File exists
 insserv: can not symlink(../init.d/hwclock.sh, ../rc0.d/K06hwclock.sh): File exists
 insserv: can not symlink(../init.d/hwclock.sh, ../rc0.d/K06hwclock.sh): File exists
 insserv: can not symlink(../init.d/open-iscsi, ../rc0.d/K02open-iscsi): File exists
 insserv: can not symlink(../init.d/rsyslog, ../rc0.d/K05rsyslog): File exists
 insserv: can not symlink(../init.d/mdadm-waitidle, ../rc0.d/K10mdadm-waitidle): File exists
 insserv: can not symlink(../init.d/iscsid, ../rc1.d/K03iscsid): File exists
 insserv: can not symlink(../init.d/open-iscsi, ../rc1.d/K02open-iscsi): File exists
 insserv: can not symlink(../init.d/rsyslog, ../rc1.d/K05rsyslog): File exists
 insserv: can not symlink(../init.d/ondemand, ../rc2.d/S03ondemand): File exists
 insserv: can not symlink(../init.d/rc.local, ../rc2.d/S03rc.local): File exists
 insserv: can not symlink(../init.d/ondemand, ../rc3.d/S03ondemand): File exists
 insserv: can not symlink(../init.d/rc.local, ../rc3.d/S03rc.local): File exists
 insserv: can not symlink(../init.d/ondemand, ../rc4.d/S03ondemand): File exists
 insserv: can not symlink(../init.d/rc.local, ../rc4.d/S03rc.local): File exists
 insserv: can not symlink(../init.d/ondemand, ../rc5.d/S03ondemand): File exists
 insserv: can not symlink(../init.d/rc.local, ../rc5.d/S03rc.local): File exists
 insserv: can not symlink(../init.d/sendsigs, ../rc6.d/K04sendsigs): File exists
 insserv: can not symlink(../init.d/sendsigs, ../rc6.d/K04sendsigs): File exists
 insserv: can not symlink(../init.d/umountnfs.sh, ../rc6.d/K06umountnfs.sh): File exists
 insserv: can not symlink(../init.d/umountnfs.sh, ../rc6.d/K06umountnfs.sh): File exists
 insserv: can not symlink(../init.d/iscsid, ../rc6.d/K03iscsid): File exists
 insserv: can not symlink(../init.d/networking, ../rc6.d/K07networking): File exists
 insserv: can not symlink(../init.d/umountfs, ../rc6.d/K08umountfs): File exists
 insserv: can not symlink(../init.d/umountfs, ../rc6.d/K08umountfs): File exists
 insserv: can not symlink(../init.d/umountroot, ../rc6.d/K09umountroot): File exists
 insserv: can not symlink(../init.d/umountroot, ../rc6.d/K09umountroot): File exists
 insserv: can not symlink(../init.d/hwclock.sh, ../rc6.d/K06hwclock.sh): File exists
 insserv: can not symlink(../init.d/hwclock.sh, ../rc6.d/K06hwclock.sh): File exists
 insserv: can not symlink(../init.d/open-iscsi, ../rc6.d/K02open-iscsi): File exists
 insserv: can not symlink(../init.d/reboot, ../rc6.d/K11reboot): File exists
 insserv: can not symlink(../init.d/reboot, ../rc6.d/K11reboot): File exists
 insserv: can not symlink(../init.d/rsyslog, ../rc6.d/K05rsyslog): File exists
 insserv: can not symlink(../init.d/mdadm-waitidle, ../rc6.d/K10mdadm-waitidle): File exists
 insserv: can not symlink(../init.d/hwclock.sh, ../rcS.d/S04hwclock.sh): File exists
 insserv: can not symlink(../init.d/mountdevsubfs.sh, ../rcS.d/S03mountdevsubfs.sh): File exists
 insserv: can not symlink(../init.d/checkroot.sh, ../rcS.d/S05checkroot.sh): File exists
 insserv: can not symlink(../init.d/mountnfs-bootclean.sh, ../rcS.d/S10mountnfs-bootclean.sh): File exists
 insserv: can not symlink(../init.d/mountnfs.sh, ../rcS.d/S09mountnfs.sh): File exists
 insserv: can not symlink(../init.d/bootmisc.sh, ../rcS.d/S11bootmisc.sh): File exists
 insserv: can not symlink(../init.d/checkfs.sh, ../rcS.d/S07checkfs.sh): File exists
 insserv: can not symlink(../init.d/mountall.sh, ../rcS.d/S08mountall.sh): File exists
 insserv: can not symlink(../init.d/mountall-bootclean.sh, ../rcS.d/S09mountall-bootclean.sh): File exists
 insserv: can not symlink(../init.d/procps, ../rcS.d/S03procps): File exists
 diff: /var/lib/apparmor/profiles/.apparmor.md5sums: No such file or directory
 Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
 Setting up cgroupfs-mount (1.2) ...
 Setting up libltdl7:amd64 (2.4.6-0.1) ...
 Setting up docker-engine (1.11.2-0~xenial) ...
 Setting up liberror-perl (0.17-1.2) ...
 Setting up git-man (1:2.7.4-0ubuntu1.1) ...
 Setting up git (1:2.7.4-0ubuntu1.1) ...
 Setting up patch (2.7.5-1) ...
 Processing triggers for systemd (229-4ubuntu17) ...
 Processing triggers for libc-bin (2.23-0ubuntu7) ...

 

After installing Docker, we are now able to install Kubelet, Kubeadm, Kubectl and Kubernetes CNI.

 

The kubelet is the primary “node agent” that runs on each node.

The kubectl is a command line interface for running commands against Kubernetes clusters.

 

The Kubernetes CNI is the CNI (Container Network Interface) project, a specification and libraries for writing plugins to configure network interfaces in Linux containers. CNI has a wide range of support and the specification is simple to implement.

Who is also using CNI?

Container runtimes

 

Installing Kubelet, Kubeadm, Kubectl and Kubernetes CNI.

This will make sure that you have the proper commands in place, and that you are able to generate all the required tokens and very easily configure your very new Kubernetes cluster:

 root@kubernetes-1:~# apt-get install -y kubelet kubeadm kubectl kubernetes-cni
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 The following additional packages will be installed:
 ebtables ethtool
 The following NEW packages will be installed:
 ebtables ethtool kubeadm kubectl kubelet kubernetes-cni
 0 upgraded, 6 newly installed, 0 to remove and 11 not upgraded.
 Need to get 42.9 MB of archives.
 After this operation, 323 MB of additional disk space will be used.
 Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 ebtables amd64 2.0.10.4-3.4ubuntu1 [79.6 kB]
 Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 ethtool amd64 1:4.5-1 [97.5 kB]
 Get:3 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubernetes-cni amd64 0.5.1-00 [5560 kB]
 Get:4 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubelet amd64 1.6.4-00 [18.3 MB]
 Get:5 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubectl amd64 1.6.4-00 [9659 kB]
 Get:6 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubeadm amd64 1.6.4-00 [9234 kB]
 Fetched 42.9 MB in 5s (7779 kB/s)
 perl: warning: Setting locale failed.
 perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LC_TIME = "nl_NL.UTF-8",
 LC_MONETARY = "nl_NL.UTF-8",
 LC_ADDRESS = "nl_NL.UTF-8",
 LC_TELEPHONE = "nl_NL.UTF-8",
 LC_NAME = "nl_NL.UTF-8",
 LC_MEASUREMENT = "nl_NL.UTF-8",
 LC_IDENTIFICATION = "nl_NL.UTF-8",
 LC_NUMERIC = "nl_NL.UTF-8",
 LC_PAPER = "nl_NL.UTF-8",
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
 perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
 debconf: unable to initialize frontend: Dialog
 debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 6.)
 debconf: falling back to frontend: Readline
 Selecting previously unselected package ebtables.
 (Reading database ... 24924 files and directories currently installed.)
 Preparing to unpack .../ebtables_2.0.10.4-3.4ubuntu1_amd64.deb ...
 Unpacking ebtables (2.0.10.4-3.4ubuntu1) ...
 Selecting previously unselected package ethtool.
 Preparing to unpack .../ethtool_1%3a4.5-1_amd64.deb ...
 Unpacking ethtool (1:4.5-1) ...
 Selecting previously unselected package kubernetes-cni.
 Preparing to unpack .../kubernetes-cni_0.5.1-00_amd64.deb ...
 Unpacking kubernetes-cni (0.5.1-00) ...
 Selecting previously unselected package kubelet.
 Preparing to unpack .../kubelet_1.6.4-00_amd64.deb ...
 Unpacking kubelet (1.6.4-00) ...
 Selecting previously unselected package kubectl.
 Preparing to unpack .../kubectl_1.6.4-00_amd64.deb ...
 Unpacking kubectl (1.6.4-00) ...
 Selecting previously unselected package kubeadm.
 Preparing to unpack .../kubeadm_1.6.4-00_amd64.deb ...
 Unpacking kubeadm (1.6.4-00) ...
 Processing triggers for systemd (229-4ubuntu17) ...
 Processing triggers for man-db (2.7.5-1) ...
 Setting up ebtables (2.0.10.4-3.4ubuntu1) ...
 update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
 Setting up ethtool (1:4.5-1) ...
 Setting up kubernetes-cni (0.5.1-00) ...
 Setting up kubelet (1.6.4-00) ...
 Setting up kubectl (1.6.4-00) ...
 Setting up kubeadm (1.6.4-00) ...
 Processing triggers for systemd (229-4ubuntu17) ...

 

Running Kubeadm init

Now is time to start Kubeadm, if you followed all the steps until here, you are very likely to get a clean install of Kubeadm, however, this is Kubernetes, kubeadm is alpha and you may hit the wall:

 root@kubernetes-1:~# kubeadm init
 [kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
 [init] Using Kubernetes version: v1.6.4
 [init] Using Authorization mode: RBAC
 [preflight] Running pre-flight checks
 [preflight] The system verification failed. Printing the output from the verification:
 OS: Linux
 KERNEL_VERSION: 4.4.0-77-generic
 CGROUPS_CPU: enabled
 CGROUPS_CPUACCT: enabled
 CGROUPS_CPUSET: enabled
 CGROUPS_DEVICES: enabled
 CGROUPS_FREEZER: enabled
 CGROUPS_MEMORY: enabled
 DOCKER_VERSION: 1.11.2
 DOCKER_GRAPH_DRIVER: aufs
 [preflight] Some fatal errors occurred:
 failed to parse kernel config: unable to load kernel module "configs": output - "modprobe: FATAL: Module configs not found in directory /lib/modules/4.4.0-77-generic\n", err - exit status 1
 [preflight] If you know what you are doing, you can skip pre-flight checks with `--skip-preflight-checks`

 

This just happened to you ? Do not worry, we are not google cloud docs, we use the commands and if is not working, I will advise you the best way to deal with it:

 

Fixing the Kubeadm installation error: failed to parse kernel config: unable to load kernel module “configs”:

The best way to deal with this is to install the kernel module configs that kubeadm installation is checking for, and that can be real easy done with the following command:

root@kubernetes-1:~# apt-get install linux-image-$(uname -r)
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 Suggested packages:
 fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools linux-headers-4.4.0-77-generic
 The following NEW packages will be installed:
 linux-image-4.4.0-77-generic
 0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
 Need to get 21.9 MB of archives.
 After this operation, 66.8 MB of additional disk space will be used.
 Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-4.4.0-77-generic amd64 4.4.0-77.98 [21.9 MB]
 Fetched 21.9 MB in 0s (22.1 MB/s)
 perl: warning: Setting locale failed.
 perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LC_TIME = "nl_NL.UTF-8",
 LC_MONETARY = "nl_NL.UTF-8",
 LC_ADDRESS = "nl_NL.UTF-8",
 LC_TELEPHONE = "nl_NL.UTF-8",
 LC_NAME = "nl_NL.UTF-8",
 LC_MEASUREMENT = "nl_NL.UTF-8",
 LC_IDENTIFICATION = "nl_NL.UTF-8",
 LC_NUMERIC = "nl_NL.UTF-8",
 LC_PAPER = "nl_NL.UTF-8",
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
 perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
 debconf: unable to initialize frontend: Dialog
 debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
 debconf: falling back to frontend: Readline
 Selecting previously unselected package linux-image-4.4.0-77-generic.
 (Reading database ... 24989 files and directories currently installed.)
 Preparing to unpack .../linux-image-4.4.0-77-generic_4.4.0-77.98_amd64.deb ...
 debconf: unable to initialize frontend: Dialog
 debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
 debconf: falling back to frontend: Readline
 Done.
 Unpacking linux-image-4.4.0-77-generic (4.4.0-77.98) ...
 Setting up linux-image-4.4.0-77-generic (4.4.0-77.98) ...
 Running depmod.
 update-initramfs: deferring update (hook will be called later)
 Examining /etc/kernel/postinst.d.
 run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-77-generic /boot/vmlinuz-4.4.0-77-generic
 run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-77-generic /boot/vmlinuz-4.4.0-77-generic
 update-initramfs: Generating /boot/initrd.img-4.4.0-77-generic
 W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
 W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
 run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-77-generic /boot/vmlinuz-4.4.0-77-generic
 run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-77-generic /boot/vmlinuz-4.4.0-77-generic
 Generating grub configuration file ...
 Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
 Found linux image: /boot/vmlinuz-4.4.0-77-generic
 Found initrd image: /boot/initrd.img-4.4.0-77-generic
 done

 

Installing Kubeadm (No errors this time)

Now is time, for you to be finally from the cloud provider expensive fees, and get yourself a brand new kubernetes installation on your bare-metal server!!!! YEY!!!

 

 root@kubernetes-1:~# kubeadm init
 [kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
 [init] Using Kubernetes version: v1.6.4
 [init] Using Authorization mode: RBAC
 [preflight] Running pre-flight checks
 [certificates] Generated CA certificate and key.
 [certificates] Generated API server certificate and key.
 [certificates] API Server serving cert is signed for DNS names [kubernetes-1 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 147.75.100.45]
 [certificates] Generated API server kubelet client certificate and key.
 [certificates] Generated service account token signing key and public key.
 [certificates] Generated front-proxy CA certificate and key.
 [certificates] Generated front-proxy client certificate and key.
 [certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
 [kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
 [kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
 [kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
 [kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
 [apiclient] Created API client, waiting for the control plane to become ready
 [apiclient] All control plane components are healthy after 39.553551 seconds
 [apiclient] Waiting for at least one node to register
 [apiclient] First node has registered after 9.004966 seconds
 [token] Using token: 6b23b1.39a6163ce456f249
 [apiconfig] Created RBAC rules
 [addons] Created essential addon: kube-proxy
 [addons] Created essential addon: kube-dns

Your Kubernetes master has initialized successfully!

To start using your cluster, you need to run (as a regular user):

 sudo cp /etc/kubernetes/admin.conf $HOME/
 sudo chown $(id -u):$(id -g) $HOME/admin.conf
 export KUBECONFIG=$HOME/admin.conf

 You should now deploy a pod network to the cluster.
 Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
 http://kubernetes.io/docs/admin/addons/

 You can now join any number of machines by running the following on each node
 as root:

 kubeadm join --token 6b23b1.39a6163ce456f249 147.75.100.45:6443

 

 

Configuring Kubeadm

So lets follow the install instructions and first we will make sure that the admin.conf is properly setup in our cluster, this will make sure the kubectl is pointing to the right place:

 sudo cp /etc/kubernetes/admin.conf $HOME/
 sudo chown $(id -u):$(id -g) $HOME/admin.conf
 export KUBECONFIG=$HOME/admin.conf

 

Adding two legs to the Kubernetes cluster:

In order to join other machines into the cluster its really easy, just run the suggested command by Kubeadm init, in the case of this tutorial is:

kubeadm join --token 6b23b1.39a6163ce456f249 147.75.100.45:6443

If you run this in two other servers and get back to master and run the following command, you should see the 3 legs of your cluster pumping and alive:

 root@kubernetes-1:~# kubectl get nodes
 NAME STATUS AGE VERSION
 kubernetes-1 NotReady 1h v1.6.4
 kubernetes-2 NotReady 2m v1.6.4
 kubernetes-3 NotReady 2m v1.6.4

 

Thats it, you have a cluster of 3 legs with Kubernetes on bare-metal server without having to do any hard thinking, just by following some simple steps. Easy huh ? 🙂

This is all for today, next time we will be following some more steps for installing the pod network and configuring helm charts, Stay tuned.

 

 

Happy coding everyone.

 

linux, ubuntu

How to restore Ubuntu 16.04 “Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)”

Today one of the guys on my development team ran into an old problem on Linux, the good and old Kernel panic …  This time it was after updating Ubuntu 16.04 internals.

After doing the reboot, there it was, the old good linux scaring n00bies away:

Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Screenshot_20170512_144757

This is an old problem and usually, depending on the tooling you have around it, it can be quite time-consuming to figure a way out if you are not experienced on Linux.

The problem originated because he installed updates on Ubuntu, one after another during many months of usage, until a day … nothing special, he updated once again and boom!!! The updates caused the /boot partition to be left with no space, and this caused the grub to be blocked when trying to mount the root fs. The solution is simple: just to remove the old kernel images and run a quick cleanup.

I believe if a piece of software or program is not clear enough for an average person to understand and solve, than its broken and it should be properly fixed or at least documented until it can be fixed permanently.

 

[SOLVED] kernel panic-not syncing:

Start your Ubuntu with shift pressed until you see the recover screen, choose recovery mode:

boot-to-ubuntu-recovery-mode.png.pagespeed.ce.CUNCHGQyPh (1)

Cleaning up Boot partition on Ubuntu 16.04

When on Rescue Mode, select the option clean followed by dpkg, grub and fsck.

boot-to-ubuntu-recovery-mode.png.pagespeed.ce.CUNCHGQyPh

This will make sure that the space on your boot partition is free, will repair any broken packages, check all file systems and that they are correct and update your grub bootloader.

After this, you are very likely to get a stable Ubuntu 16.04 back.

 

 

The command line way to clean up /boot partition:

 

It can be that you open your computer, and it will boot normally, but Ubuntu will complain that the boot partition is almost full, in this case you can execute the auto-remove:

 

$ sudo apt-get autoremove --purge
[sudo] password for ninja: 
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following packages will be REMOVED:
 linux-headers-4.4.0-79 linux-headers-4.4.0-79-generic linux-headers-4.4.0-81
 linux-headers-4.4.0-81-generic linux-headers-4.8.0-49
 linux-headers-4.8.0-49-generic linux-headers-4.8.0-51
 linux-headers-4.8.0-51-generic linux-headers-4.8.0-52
 linux-headers-4.8.0-52-generic linux-headers-4.8.0-54
 linux-headers-4.8.0-54-generic linux-image-4.4.0-79-generic
 linux-image-4.4.0-81-generic linux-image-4.8.0-49-generic
 linux-image-4.8.0-51-generic linux-image-4.8.0-52-generic
 linux-image-4.8.0-54-generic linux-image-extra-4.4.0-79-generic
 linux-image-extra-4.4.0-81-generic linux-image-extra-4.8.0-49-generic
 linux-image-extra-4.8.0-51-generic linux-image-extra-4.8.0-52-generic
 linux-image-extra-4.8.0-54-generic
0 upgraded, 0 newly installed, 24 to remove and 93 not upgraded.
9 not fully installed or removed.
After this operation, 1854 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 497711 files and directories currently installed.)
Removing linux-headers-4.4.0-79-generic (4.4.0-79.100) ...
Removing linux-headers-4.4.0-79 (4.4.0-79.100) ...
Removing linux-headers-4.4.0-81-generic (4.4.0-81.104) ...
Removing linux-headers-4.4.0-81 (4.4.0-81.104) ...
Removing linux-headers-4.8.0-49-generic (4.8.0-49.52~16.04.1) ...
Removing linux-headers-4.8.0-49 (4.8.0-49.52~16.04.1) ...
Removing linux-headers-4.8.0-51-generic (4.8.0-51.54~16.04.1) ...
Removing linux-headers-4.8.0-51 (4.8.0-51.54~16.04.1) ...
Removing linux-headers-4.8.0-52-generic (4.8.0-52.55~16.04.1) ...
Removing linux-headers-4.8.0-52 (4.8.0-52.55~16.04.1) ...
Removing linux-headers-4.8.0-54-generic (4.8.0-54.57~16.04.1) ...
Removing linux-headers-4.8.0-54 (4.8.0-54.57~16.04.1) ...
Removing linux-image-extra-4.4.0-79-generic (4.4.0-79.100) ...
(...)
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.8.0-58-generic
Found initrd image: /boot/initrd.img-4.8.0-58-generic
Found linux image: /boot/vmlinuz-4.8.0-56-generic
Found initrd image: /boot/initrd.img-4.8.0-56-generic
Found linux image: /boot/vmlinuz-4.4.0-83-generic
Found initrd image: /boot/initrd.img-4.4.0-83-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Setting up linux-image-generic-hwe-16.04 (4.8.0.58.29) ...
Setting up linux-generic-hwe-16.04 (4.8.0.58.29) ...
Setting up linux-image-extra-virtual (4.4.0.83.89) ...
ninja@ninja:~$ sudo apt-get autoremove --purge
Reading package lists... Done
Building dependency tree 
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 93 not upgraded.

 

Then finally you can update GRUB kernel list:

$ sudo update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.8.0-58-generic
Found initrd image: /boot/initrd.img-4.8.0-58-generic
Found linux image: /boot/vmlinuz-4.8.0-56-generic
Found initrd image: /boot/initrd.img-4.8.0-56-generic
Found linux image: /boot/vmlinuz-4.4.0-83-generic
Found initrd image: /boot/initrd.img-4.4.0-83-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done

 

 

Check the partition sizes with ncdu:

If you dont have it, then install with:

$ sudo apt-get install ncdu

Alternatively you can:

check the partition sizes with lsblk:

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop1 7:1 0 88,1M 1 loop /snap/conjure-up/518
loop4 7:4 0 79,5M 1 loop /snap/core/2312
loop2 7:2 0 88,1M 1 loop /snap/conjure-up/527
loop0 7:0 0 79,5M 0 loop /snap/core/1689
nvme0n1 259:0 0 477G 0 disk 
├─nvme0n1p5 259:3 0 476,5G 0 part 
│ └─nvme0n1p5_crypt 253:0 0 476,5G 0 crypt 
│ ├─ubuntu--vg-root 253:1 0 460,9G 0 lvm /
│ └─ubuntu--vg-swap_1 253:2 0 15,6G 0 lvm 
│ └─cryptswap1 253:3 0 15,6G 0 crypt [SWAP]
├─nvme0n1p1 259:1 0 487M 0 part /boot
└─nvme0n1p2 259:2 0 1K 0 part 
loop5 7:5 0 78,4M 0 loop /snap/core/1577
loop3 7:3 0 88,2M 1 loop /snap/conjure-up/510

 

Or you can also:

Check the partition sizes with baobab:

$ sudo baobab

 

Now just restart the Ubuntu and it should be as good as before! 🙂

 

Ubuntu-is-a-operating-system1

Happy Open Source coding to everyone.

linux, rethinkdb, Uncategorized

Running a RethinkDB Proxy as Daemon

 

In this article we are going to learn the commands and steps to have a install daemonize package on Ubuntu 16.10,Ubuntu 14.04, CentOS 6, CentOS 7, Fedora, etc …

Quick Install Daemonize:

wget https://github.com/bmc/daemonize/archive/release-1.7.7.tar.gz
tar -xvzf release-1.7.7.tar.gz
cd daemonize-release-1.7.7/
sh configure
make
sudo make install

 

Running RethinkDB Proxy with Daemonize:

daemonize -E BUILD_ID=dontKillMe -p /opt/rethinkdb_proxy.pid \ 
/usr/bin/rethinkdb proxy --join yourcluster:29015 \
--http-port 8095 --bind all

 

Check all the other usages for daemonize:

# daemonize
daemonize, version 1.7.7
Usage: daemonize [OPTIONS] path [arg] ...

OPTIONS

-a Append to, instead of overwriting, output files. Ignored
 unless -e and/or -o are specified.
-c <dir> Set daemon's working directory to <dir>.
-e <stderr> Send daemon's stderr to file <stderr>, instead of /dev/null.
-E var=value Pass environment setting to daemon. May appear multiple times.
-o <stdout> Send daemon's stdout to file <stdout>, instead of /dev/null.
-p <pidfile> Save PID to <pidfile>.
-u <user> Run daemon as user <user>. Requires invocation as root.
-l <lockfile> Single-instance checking using lockfile <lockfile>.
-v Issue verbose messages to stdout while daemonizing.

 

Cheers.

linux, ubuntu

How to restore Ubuntu after “Can’t write PID file”

Today one of my colleagues ran into a permission problem with his Ubuntu 14.04.1 after doing the latest updates for Ubuntu.
The problem somehow is still in place, however we where able to turn around the problem by creating another user and moving the folders to the new user.

Steps to create a new user and move your things around so you can get your box back:

Start your Ubuntu with shift pressed until you see the recover screen, choose recovery mode:
ubuntu-grub-menu-recovery-mode

Then select the option root:
root-mode

Step 1:
You will then have access to the command line as root, so now create a new user with the name of your preference:
adduser vagrant_bkp sudo

Step 2:
If this happens to fail, is because your drive is not mounted with the correct permissions, so run the following command to remount it with read and write:
mount -o remount,rw /
(Now run step 1 again)

Now just restart the Ubuntu and your new user should be available for you to use, you can then sudo as root and recover your files! 🙂

Cheers.

PS: If for some reason you are not able to sudo with your new user, go back to recovery mode, execute Step 2 and after it manually add your new user to suddoers file:
vi /etc/sudoers
Add the line:
vagrant_bkp ALL=(ALL) ALL
(You may also want to add (set nocp) to VI just so it works properly), you can do this by pressing shift + : and then type set nocp and press enter.
Restart your Ubuntu box and you should be able to logIn with your new user.

linux, ubuntu

Howto – Increase disk space on a VirtualBox vmdk disk

This post is a continuation of the Howto create VirtualBox Vagrant Development Linux with Ubuntu 14.04 .
I’ve created this post in order to have documented the steps I did to increase the disk space of the VirtualBox image.

Steps to solve the error: “no space left on device error”:

Change directory to your local VirtualBox instalation, and check that it contains the executable VBoxManage. We will need it in order to clone the HD and then resize it with gparted.

Example for Windows:
cd "c:\Program Files\Oracle\VirtualBox"
c:\Program Files\Oracle\VirtualBox>dir
Volume in drive C is OS
Volume Serial Number is

Directory of c:\Program Files\Oracle\VirtualBox

24/07/2015 09:57 .
24/07/2015 09:57 ..
(…)
09/07/2015 11:09 251,656 VBoxBalloonCtrl.exe
09/07/2015 11:09 4,026,088 VBoxC.dll
09/07/2015 11:09 45,144 VBoxCAPI.dll
09/07/2015 11:09 157,408 VBoxDbg.dll
09/07/2015 11:09 2,570,216 VBoxDD.dll
09/07/2015 11:09 204,312 VBoxDD2.dll
09/07/2015 11:09 25,080 VBoxDD2R0.r0
09/07/2015 11:09 22,704 VBoxDD2RC.rc
09/07/2015 11:09 155,360 VBoxDDR0.r0
09/07/2015 11:09 124,888 VBoxDDRC.rc
09/07/2015 11:09 390,712 VBoxDDU.dll
09/07/2015 11:09 44,120 VBoxDragAndDropSvc.dll
09/07/2015 11:09 18,368 VBoxDTrace.exe
09/07/2015 10:41 1,048,576 VBoxEFI32.fd
09/07/2015 10:41 1,048,576 VBoxEFI64.fd
09/07/2015 11:09 60,600 VBoxExtPackHelperApp.exe
09/07/2015 10:59 58,601,472 VBoxGuestAdditions.iso
09/07/2015 11:09 46,704 VBoxGuestControlSvc.dll
09/07/2015 11:09 49,288 VBoxGuestPropSvc.dll
09/07/2015 11:09 411,800 VBoxHeadless.dll
09/07/2015 11:09 1,163,712 VBoxHeadless.exe
09/07/2015 11:09 26,104 VBoxHostChannel.dll
09/07/2015 11:09 1,290,920 VBoxManage.exe
09/07/2015 11:09 460,216 VBoxNetDHCP.dll
09/07/2015 11:09 1,163,712 VBoxNetDHCP.exe
09/07/2015 11:09 569,944 VBoxNetNAT.dll
09/07/2015 11:09 1,163,712 VBoxNetNAT.exe
09/07/2015 11:09 200,680 VBoxOGLhostcrutil.dll
09/07/2015 11:09 99,216 VBoxOGLhosterrorspu.dll
09/07/2015 11:09 124,960 VBoxOGLrenderspu.dll
09/07/2015 11:09 676,552 VBoxREM.dll
09/07/2015 11:08 947,912 VBoxRes.dll
09/07/2015 11:09 5,492,296 VBoxRT.dll
09/07/2015 11:09 480,304 VBoxSDL.dll
09/07/2015 11:09 1,164,224 VBoxSDL.exe
09/07/2015 11:09 30,736 VBoxSharedClipboard.dll
09/07/2015 11:09 1,140,016 VBoxSharedCrOpenGL.dll
09/07/2015 11:09 41,560 VBoxSharedFolders.dll
09/07/2015 11:08 12,176 VBoxSupLib.dll
09/07/2015 11:09 5,737,936 VBoxSVC.exe
09/07/2015 11:09 157,944 VBoxTestOGL.exe
09/07/2015 11:09 2,693,792 VBoxVMM.dll
09/07/2015 11:11 17,172,512 VBoxWebSrv.exe
09/07/2015 10:52 2,355,485 VirtualBox.chm
09/07/2015 11:09 11,252,072 VirtualBox.dll
09/07/2015 11:09 1,164,224 VirtualBox.exe
09/07/2015 11:09 1,172,536 VMMR0.r0
09/07/2015 11:09 841,448 VMMRC.rc
24/07/2015 09:57 x86
60 File(s) 148,113,539 bytes
8 Dir(s) 102,299,119,616 bytes free

Ok, so now that you are in the right directory, execute the following command:
VBoxManage clonehd “box-disk1.vmdk” “cloned.vdi” –format vdi

Have in mind that you should use absolute paths in order to properly locate the folders, as the example:
c:\Program Files\Oracle\VirtualBox>VBoxManage clonehd "C:\Users\tmodeneis\VirtualBox VMs\ubuntudesktop_default_1444393401994_92719\box-disk1.vmdk" "C:\VirtualBox VMs\cloned.vdi" --format vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone medium created in format 'vdi'. UUID: 63ab6f6f-5776-4351-9d28-565bac925f03

c:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd “C:\VirtualBox VMs\cloned
.vdi” –resize 30720
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%

Ok now we have cloned our old vmdk to vdi, the next step is to resize the partition with gparted.

1) First thing to do is replace in the virtualbox the old .vmdk to start using the just cloned new .vdi
Once this is done, Download the Live CD iso of gparted and boot the virtual box server from it.

1

2) Select the default option and complete the startup.

2

3

4

3) GParted shows the size of current partitions (15.9 GB) and the unallocated space (20 GB).
5

4) Right click on the partition to resize and select resize/move item from the popup menu.
6

5) Resize the partition by either dragging the highlighted box or adjusting the numerical spinners.
7

8

9

6) Click apply to complete the resizing.
10

11

12

7) Restart the virtual server and see the size of linux partition changed 🙂

Filesystem Size Used Avail Use% Mounted on
/dev/sda3 35G 13G 21G 39% /
/dev/sda1 99M 12M 83M 13% /boot
tmpfs 1006M 0 1006M 0% /dev/shm

Thomas.