coreos Container-Runtime,etcdctl,fleet

Working with coreos

Download iso from below path

https://stable.release.core-os.net/amd64-usr/current/coreos_production_iso_image.iso

mohammedrafi@NOC-RAFI:~$ ssh core@192.168.183.133
Password:
Last login: Thu Mar 30 12:47:59 UTC 2017 on tty1
Container Linux by CoreOS stable (1298.6.0)
Update Strategy: No Reboots
core@localhost ~ $

core@localhost ~ $ uname -a
Linux localhost 4.9.9-coreos-r1 #1 SMP Tue Mar 14 21:09:42 UTC 2017 x86_64 Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz GenuineIntel GNU/Linux

core@localhost ~ $ cat /etc/issue

This is \n (\s \m \r) \t
SSH host key: SHA256:MFc2Sui2M7q+Wqm5oiR2lYhAPFxnYoZnLiAX1fa6Bt0 (ED25519)
SSH host key: SHA256:N41S0yGRcmHhoW5ocRXZP4gQ2its1PmgGq1jhwtDsJk (ECDSA)
SSH host key: SHA256:DzfLp4JHyDSUzrbyWz7z8lfE5oiTbL50sBNLvQoNGhw (DSA)
SSH host key: SHA256:Smja4uZCIj2VP6fSeOf6whTzB0ylLTeQ/NyWmca0I8k (RSA)
ens32: \4{ens32} \6{ens32}

————
core@localhost ~ $ pwd
/home/core

core@localhost ~ $ date
Thu Mar 30 12:52:08 UTC 2017

core@localhost ~ $ whoami
core
core@localhost ~ $ su –
Password:
Update Strategy: No Reboots
localhost ~ # logout
core@localhost ~ $ sudo -i
Update Strategy: No Reboots
localhost ~ # logout
core@localhost ~ $ su
Password:
bash-4.3# echo $SHELL
/bin/bash
bash-4.3# runlevel
unknown
bash-4.3# exit
core@localhost ~ $ runlevel
unknown

core@localhost ~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 272M 0 rom
loop0 7:0 0 236.9M 0 loop /usr
sda 8:0 0 8G 0 disk

core@localhost ~ $ blkid

core@localhost ~ $ df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 365M 0 365M 0% /dev
tmpfs tmpfs 499M 0 499M 0% /dev/shm
tmpfs tmpfs 499M 13M 486M 3% /run
tmpfs tmpfs 499M 0 499M 0% /sys/fs/cgroup
tmpfs tmpfs 499M 6.9M 492M 2% /
/dev/loop0 squashfs 237M 237M 0 100% /usr
tmpfs tmpfs 499M 0 499M 0% /media
tmpfs tmpfs 499M 0 499M 0% /tmp
tmpfs tmpfs 100M 0 100M 0% /run/user/500

core@localhost ~ $ cat /etc/os-release
NAME=”Container Linux by CoreOS”
ID=coreos
VERSION=1298.6.0
VERSION_ID=1298.6.0
BUILD_ID=2017-03-14-2119
PRETTY_NAME=”Container Linux by CoreOS 1298.6.0 (Ladybug)”
ANSI_COLOR=”38;5;75″
HOME_URL=”https://coreos.com/”
BUG_REPORT_URL=”https://github.com/coreos/bugs/issues”

core@localhost ~ $ cat /etc/lsb-release
DISTRIB_ID=”Container Linux by CoreOS”
DISTRIB_RELEASE=1298.6.0
DISTRIB_CODENAME=”Ladybug”
DISTRIB_DESCRIPTION=”Container Linux by CoreOS 1298.6.0 (Ladybug)”

core@localhost ~ $ sudo useradd jack

ore@localhost ~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:66:16:0e brd ff:ff:ff:ff:ff:ff
inet 192.168.183.133/24 brd 192.168.183.255 scope global dynamic ens32
valid_lft 1374sec preferred_lft 1374sec
inet6 fe80::20c:29ff:fe66:160e/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:33:ee:b3:71 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever

core@localhost ~ $ cat /etc/shells
# /etc/shells: valid login shells
/bin/bash
/bin/sh
/sbin/nologin
/usr/bin/bash
/usr/bin/sh
/usr/sbin/nologin

core@localhost ~ $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
core@localhost ~ $ docker run ubuntu
Unable to find image ‘ubuntu:latest’ locally
latest: Pulling from library/ubuntu
d54efb8db41d: Pull complete
f8b845f45a87: Pull complete
e8db7bf7c39f: Pull complete
9654c40e9079: Pull complete
6d9ef359eaaa: Pull complete
Digest: sha256:dd7808d8792c9841d0b460122f1acf0a2dd1f56404f8d1e56298048885e45535
Status: Downloaded newer image for ubuntu:latest

core@localhost ~ $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 0ef2e08ed3fa 4 weeks ago 130 MB
core@localhost ~ $ docker –help
Usage: docker [OPTIONS] COMMAND [arg…]
docker [ –help | -v | –version ]

A self-sufficient runtime for containers.

Options:

–config=~/.docker Location of client config files
-D, –debug Enable debug mode
-H, –host=[] Daemon socket(s) to connect to
-h, –help Print usage
-l, –log-level=info Set the logging level
–tls Use TLS; implied by –tlsverify
–tlscacert=~/.docker/ca.pem Trust certs signed only by this CA
–tlscert=~/.docker/cert.pem Path to TLS certificate file
–tlskey=~/.docker/key.pem Path to TLS key file
–tlsverify Use TLS and verify the remote
-v, –version Print version information and quit

Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container’s changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container’s filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container’s filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container, image or task
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry.
logout Log out from a Docker registry.
logs Fetch the logs of a container
network Manage Docker networks
node Manage Docker Swarm nodes
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
service Manage Docker services
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
swarm Manage Docker Swarm
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code

Run ‘docker COMMAND –help’ for more information on a command.

—————–
core@localhost ~ $ systemctl list-units
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Poin
sys-devices-pci0000:00-0000:00:07.1-ata1-host1-target1:0:0-1:0:0:0-block-sda.device loaded active plugged VMware_Virtual_IDE_Hard_Drive
sys-devices-pci0000:00-0000:00:07.1-ata2-host2-target2:0:0-2:0:0:0-block-sr0.device loaded active plugged VMware_Virtual_IDE_CDROM_Drive CDROM
sys-devices-pci0000:00-0000:00:11.0-0000:02:00.0-net-ens32.device loaded active plugged /sys/devices/pci0000:00/0000:00:11.0/0000:02:00.0/net/
sys-devices-platform-serial8250-tty-ttyS0.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0

core@localhost ~ $ systemd-delta
[OVERRIDDEN] /usr/lib/sysctl.d/50-default.conf → /lib/sysctl.d/50-default.conf
Files /lib/sysctl.d/50-default.conf and /usr/lib/sysctl.d/50-default.conf are identical
[OVERRIDDEN] /usr/lib/sysctl.d/50-coredump.conf → /lib/sysctl.d/50-coredump.conf
Files /lib/sysctl.d/50-coredump.conf and /usr/lib/sysctl.d/50-coredump.conf are identical

core@localhost ~ $ systemctl status etcd
● etcd.service – etcd
Loaded: loaded (/usr/lib/systemd/system/etcd.service; static; vendor preset: disabled)
Active: inactive (dead)

core@localhost ~ $ netstat -tlpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::22 :::* LISTEN –

core@localhost ~ $ vim lighttpd.service
[Unit]
Description=Lightweight HTTP server
Requires=docker.service
[Service]
ExecStartPre=-/usr/bin/docker kill HTTPD
ExecStartPre=-/usr/bin/docker rm HTTPD
ExecStartPre=/usr/bin/docker pull jprjr/lighttpd
ExecStart=/usr/bin/docker run –name HTTPD -p 8080:8080/tcp -v /srv/httpd jprjr/lighttpd
ExecStartPost=/usr/bin/etcdctl set /services/httpd/%H:8080 running
ExecStop=/usr/bin/docker stop HTTPD
ExecStopPost=/usr/bin/etcdctl rm /services/httpd/%H:8080
[Install]
WantedBy=multi-user.target
core@localhost ~ $ sudo cp ~/lighttpd.service /etc/systemd/system/

core@localhost ~ $ sudo systemctl enable lighttpd.service
Created symlink /etc/systemd/system/multi-user.target.wants/lighttpd.service → /etc/systemd/system/lighttpd.service.

core@localhost ~ $ sudo systemctl start lighttpd.service

=============================================================

core@localhost ~ $ etcdctl set /message first
Error: client: etcd cluster is unavailable or misconfigured
error #0: dial tcp 127.0.0.1:4001: getsockopt: connection refused
error #1: dial tcp 127.0.0.1:2379: getsockopt: connection refused
core@localhost ~ $ systemctl status etcd
● etcd.service – etcd
Loaded: loaded (/usr/lib/systemd/system/etcd.service; static; vendor
Active: inactive (dead)

core@localhost ~ $ sudo systemctl start etcd

core@localhost ~ $ systemctl status etcd
● etcd.service – etcd
Loaded: loaded (/usr/lib/systemd/system/etcd.service; static; vendor
Active: active (running) since Thu 2017-03-30 14:54:04 UTC; 5s ago
Main PID: 1626 (etcd)
Tasks: 5
Memory: 12.8M
CPU: 110ms
CGroup: /system.slice/etcd.service
└─1626 /usr/bin/etcd

core@localhost ~ $ netstat -tlpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::22 :::* LISTEN –
tcp6 0 0 :::7001 :::* LISTEN –
tcp6 0 0 :::4001 :::* LISTEN –
core@localhost ~ $ etcdctl set /message first
first

core@localhost ~ $ etcdctl get /message
first

core@localhost ~ $ etcdctl mkdir /one
core@localhost ~ $ ls -l
total 0

core@localhost ~ $ etcdctl set /one/container1 localhost:1111
localhost:1111

core@localhost ~ $ etcdctl ls /one
/one/container1

core@localhost ~ $ etcdctl set /one/container1 “expiring in 15 sec” –ttl 15
expiring in 15 sec
core@localhost ~ $ etcdctl watch /one/container1 –recursive
[expire] /one/container1

core@localhost ~ $ etcdctl get /one/container1Error: 100: Key not found (/one/container1) [11]

core@localhost ~ $ etcdctl set /two “Expiring Soon” -ttl 20
Expiring Soon
core@localhost ~ $ etcdctl watch /two –recursive
[expire] /two

========================================================================

core@localhost ~ $ fleetctl list-machines
Error retrieving list of active machines: Get http://domain-sock/fleet/v1/machines?alt=json: dial unix /var/run/fleet.sock: connect: no such file or directory
core@localhost ~ $ systemctl status fleet
● fleet.service – fleet daemon
Loaded: loaded (/usr/lib/systemd/system/fleet.service; disabled; vendor preset: disabled)
Active: inactive (dead)
core@localhost ~ $ sudo systemctl start fleet
core@localhost ~ $ systemctl status fleet
● fleet.service – fleet daemon
Loaded: loaded (/usr/lib/systemd/system/fleet.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2017-03-30 16:58:22 UTC; 1s ago
Main PID: 1772 (fleetd)
Tasks: 7
Memory: 9.7M
CPU: 327ms
CGroup: /system.slice/fleet.service
└─1772 /usr/bin/fleetd

Mar 30 16:58:22 localhost systemd[1]: Started fleet daemon.
Mar 30 16:58:23 localhost fleetd[1772]: INFO fleetd.go:64: Starting fleetd version 0.11.8
Mar 30 16:58:23 localhost fleetd[1772]: INFO fleetd.go:170: No provided or default config file found – proceeding without
Mar 30 16:58:23 localhost fleetd[1772]: INFO server.go:160: Establishing etcd connectivity
Mar 30 16:58:23 localhost fleetd[1772]: INFO server.go:171: Starting server components
Mar 30 16:58:23 localhost fleetd[1772]: INFO engine.go:159: Updated cluster engine version from 0 to 1
Mar 30 16:58:23 localhost fleetd[1772]: INFO engine.go:185: Engine leadership acquired
core@localhost ~ $ fleetctl list-machines
MACHINE IP METADATA
5f51f6ac… 192.168.183.133 –

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s