Sunday, September 10, 2017

Rancher- Container OS

Rancher OS is a light weight  container Operating system, specially designed  to run Dockerized applications.


Download Rancher ISO  OS images and install it in bare metal  hardware

In my laptop I have already installed Virtual-box and docker-machine tools.I am going to 
deploying Rancher OS VM using docker-machine command.

C:\Users\Rengs>docker-machine create -d virtualbox --virtualbox-boot2docker-url https://releases.rancher.com/os/latest/rancheros.iso Rancher-test
Running pre-create checks...
(Rancher-test) Boot2Docker URL was explicitly set to "https://releases.rancher.com/os/latest/rancheros.iso" at create time, so Docker Machine cannot upgrade thi
Creating machine...
(Rancher-test) Boot2Docker URL was explicitly set to "https://releases.rancher.com/os/latest/rancheros.iso" at create time, so Docker Machine cannot upgrade thi
(Rancher-test) Downloading C:\Users\Rengs\.docker\machine\cache\boot2docker.iso from https://releases.rancher.com/os/latest/rancheros.iso...
(Rancher-test) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
(Rancher-test) Creating VirtualBox VM...
(Rancher-test) Creating SSH key...
(Rancher-test) Starting the VM...
(Rancher-test) Check network to re-create if needed...
(Rancher-test) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with rancheros...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, 
run: docker-machine env Rancher-test
C:\Users\Rengs>docker-machine ls
NAME           ACTIVE   DRIVER       STATE     URL        SWARM   DOCKER    ERRORS
default        -        virtualbox   Saved                                  Unknown
Rancher-test   -        virtualbox   Running   tcp://192.168.99.100:2376    v1.12.6

C:\Users\Rengs>
Login to the Rancher VM
C:\Users\Rengs>docker-machine ssh Rancher-test
[docker@Rancher-test ~]$

Verifying the Rancher OS version and other details.
[docker@Rancher-test ~]$ uname -a
Linux Rancher-test 4.9.9-rancher #1 SMP Thu Feb 9 13:00:19 UTC 2017 x86_64 GNU/Linux
[docker@Rancher-test /]$ ros -v
ros version v0.8.0
Checking disk usage. It uses maximum 460MB disk space for OS.
[docker@Rancher-test ~]$
[docker@Rancher-test ~]$ df -h
Filesystem          Size      Used Available Use% Mounted on
overlay             19.1G    459.6M     17.7G   2% /
tmpfs               477.5M         0    477.5M   0% /dev
tmpfs               497.0M         0    497.0M   0% /sys/fs/cgroup
/dev/sda            19.1G    459.6M     17.7G   2% /home
none               497.0M    628.0K    496.4M   0% /run
/dev/sda           19.1G    459.6M     17.7G   2% /media
/dev/sda           19.1G    459.6M     17.7G   2% /opt
/dev/sda           19.1G    459.6M     17.7G   2% /mnt
/dev/sda           19.1G    459.6M     17.7G   2% /var/log
/dev/sda           19.1G    459.6M     17.7G   2% /usr/sbin/iptables
devtmpfs           477.5M         0    477.5M   0% /host/dev
shm                64.0M         0     64.0M   0% /host/dev/shm
/dev/sda           19.1G    459.6M     17.7G   2% /etc/docker
/dev/sda           19.1G    459.6M     17.7G   2% /etc/selinux
/dev/sda           19.1G    459.6M     17.7G   2% /usr/lib/modules
none                497.0M    628.0K    496.4M   0% /var/run
/dev/sda            19.1G    459.6M     17.7G   2% /usr/lib/firmware
/dev/sda            19.1G    459.6M     17.7G   2% /var/lib/rancher
/dev/sda            19.1G    459.6M     17.7G   2% /var/lib/docker
/dev/sda            19.1G    459.6M     17.7G   2% /usr/bin/ros
/dev/sda            19.1G    459.6M     17.7G   2% /usr/share/ros
/dev/sda            19.1G    459.6M     17.7G   2% /var/lib/rancher/conf
/dev/sda            19.1G    459.6M     17.7G   2% /etc/ssl/certs/ca-certificates.crt.rancher
/dev/sda            19.1G    459.6M     17.7G   2% /var/lib/rancher/cache
/dev/sda            19.1G    459.6M     17.7G   2% /etc/resolv.conf
/dev/sda            19.1G    459.6M     17.7G   2% /etc/hostname
/dev/sda            19.1G    459.6M     17.7G   2% /etc/hosts
shm                 64.0M         0     64.0M   0% /dev/shm
devtmpfs            477.5M         0    477.5M   0% /dev
shm                 64.0M         0     64.0M   0% /dev/shm
/dev/sda            19.1G    459.6M     17.7G   2% /var/lib/docker/overlay
[docker@Rancher-test ~]$
There are two Docker daemons running in Rancher OS.


 i) System Docker - Where Rancher OS runs System services. System Docker can  only used by root.
ii) Normal Docker - Where our application containers will be deployed

[docker@Rancher-test ~]$ sudo system-docker ps
CONTAINER ID        IMAGE          COMMAND        CREATED    STATUS     PORTS  NAMES
7e27e12d5258  ancher/os-docker:1.12.6  "ros user-docker"   6 min ago  Up 6 min docker
f02bd52571c5 rancher/os-console:v0.8.0 "/usr/bin/ros entrypo" 6 min ago Up 6 min console
dacc85ba24c6  rancher/os-base:v0.8.0  "/usr/bin/ros entrypo"  6 min ago  Up 6 min ntp
e50103a50c6f rancher/os-base:v0.8.0  "/usr/bin/ros entrypo" 6 min ago  Up 6 min  network
777b16ef8d95 rancher/os-base:v0.8.0  "/usr/bin/ros entrypo" 6 min ago Up 6 min   udev
974eb14cc628 rancher/os-base:v0.8.0  "/usr/bin/ros entrypo" 6 min ago Up 6 min  syslog
90478b595064 rancher/os-acpid:v0.8.0  "/usr/bin/ros entrypo" 6 min ago Up 6 min acpid


[docker@Rancher-test /]$ sudo ros engine list
disabled docker-1.10.3
disabled docker-1.11.2
current  docker-1.12.6
disabled docker-1.13.1
[docker@Rancher-test ~]$ sudo docker ps
CONTAINER ID        IMAGE       COMMAND      CREATED      STATUS      PORTS    NAMES
[docker@Rancher-test ~]$ docker --version
Docker version 1.12.6, build 78d1802

 

ROS administration commands

 Changing docker engine version in ROS
sudo ros engine switch docker-1.11.2

Start other docker engine after next reboot
$ sudo ros engine enable docker-1.10.3
Network configuration
$ sudo ros config set rancher.network.interfaces.eth1.address 172.68.1.100/24
$ sudo ros config set rancher.network.interfaces.eth1.gateway 172.68.1.1
$ sudo ros config set rancher.network.interfaces.eth1.mtu 1500
$ sudo ros config set rancher.network.interfaces.eth1.dhcp false

Upgrade ROS
[docker@Rancher-test /]$ sudo ros os version
v0.8.0
[docker@Rancher-test /]$ sudo ros os list
rancher/os:v0.8.0 remote latest running
rancher/os:v0.7.1 remote available
rancher/os:v0.7.0 remote available
rancher/os:v0.6.1 remote available
rancher/os:v0.6.0 remote available
rancher/os:v0.5.0 remote available
rancher/os:v0.4.5 remote available
rancher/os:v0.4.4 remote available
rancher/os:v0.4.3 remote available
rancher/os:v0.4.2 remote available
rancher/os:v0.4.1 remote available
rancher/os:v0.4.0 remote available
[docker@Rancher-test /]$
[docker@Rancher-test /]$ sudo ros os upgrade
Upgrading to rancher/os:v0.8.0
Already at version v0.8.0. Continue anyway [y/N]: N
[docker@Rancher-test /]$

Configuration file

sudo cat /var/lib/rancher/conf/cloud-config.yml

No comments:

Post a Comment

AWS Autoscaling demo lab Configuring VPC, Public/Private subnets, Internet Gateway (IGW), NAT gateway, etc.,   Crea...