Skip to content

Instantly share code, notes, and snippets.

@mcastelino
Created April 8, 2019 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcastelino/533bd97b3b5690b726bbe82692a28bab to your computer and use it in GitHub Desktop.
Save mcastelino/533bd97b3b5690b726bbe82692a28bab to your computer and use it in GitHub Desktop.
kata with footloose machine containers

Machine containers with Kata

kata-footloose$ docker info  | grep runtime
WARNING: No swap limit support
Runtimes: kata-runtime runc
Default Runtime: kata-runtime
kata-footloose$ footloose show
  NAME                HOSTNAME    PORTS      IP          IMAGE                                  CMD         STATE    
  cluster-fedora0     fedora0     22->32768  172.17.0.2  quay.io/footloose/fedora29:latest      /sbin/init  Running  
  cluster-centos0     centos0     22->32769  172.17.0.3  quay.io/footloose/centos7:latest       /sbin/init  Running  
  cluster-xenial0     xenial0     22->32770  172.17.0.4  quay.io/footloose/ubuntu16.04:latest   /sbin/init  Running  
  cluster-bionic0     bionic0     22->32771  172.17.0.5  quay.io/footloose/ubuntu18.04:latest   /sbin/init  Running  
  cluster-amzlinux0   amzlinux0   22->32772  172.17.0.6  quay.io/footloose/amazonlinux2:latest  /sbin/init  Running  
  cluster-debian10-0  debian10-0  22->32773  172.17.0.7  quay.io/footloose/debian10:latest      /sbin/init  Running  
kata-footloose$ sudo kata-runtime list
ID                                                                 PID         STATUS      BUNDLE                                                                                                                               CREATED                          OWNER
fb7b8a61829797cf4d18d319cc338cc720b1f07ea78b20023553d82dba2705c1   3250        running     /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/fb7b8a61829797cf4d18d319cc338cc720b1f07ea78b20023553d82dba2705c1   2019-04-08T17:55:30.243632522Z   #0
c258e3ff6a3218f0fb376f8958ce556487eefe0cc9adfe48cb131536fc1e1683   2587        running     /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/c258e3ff6a3218f0fb376f8958ce556487eefe0cc9adfe48cb131536fc1e1683   2019-04-08T17:55:12.195596992Z   #0
04328c36f20ebf6abc38f0c9a9e7e127a17d735b23ace68b0237c87c533cb5e1   2245        running     /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/04328c36f20ebf6abc38f0c9a9e7e127a17d735b23ace68b0237c87c533cb5e1   2019-04-08T17:55:03.670328644Z   #0
6ea1b79b215c710c4ffb9038e1b56f1e1b1690064522c63f96aef9bfe9ba790f   3593        running     /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/6ea1b79b215c710c4ffb9038e1b56f1e1b1690064522c63f96aef9bfe9ba790f   2019-04-08T17:55:38.133325806Z   #0
cd913c7dee9fe4d524e665196cd0454648d8d7e5d51808692db2d1f799683976   3919        running     /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/cd913c7dee9fe4d524e665196cd0454648d8d7e5d51808692db2d1f799683976   2019-04-08T17:55:47.393391689Z   #0
3ba215c774eec6ee7592b72993447eb3116d5f800556dc15aee69314645daeed   2920        running     /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/3ba215c774eec6ee7592b72993447eb3116d5f800556dc15aee69314645daeed   2019-04-08T17:55:21.186334535Z   #0
kata-footloose$ footloose ssh root@centos0
System is booting up. See pam_nologin(8)
[root@centos0 ~]# uname -r
4.19.28-22.container
[root@centos0 ~]# exit
logout
Connection to localhost closed.
kata-footloose$ uname -r
4.15.0-47-generic
kata-footloose$ 
@mcastelino
Copy link
Author

At the lowest level if you want to do this without footloose

docker run -d --mount type=tmpfs,destination=/run --mount type=tmpfs,destination=/run/lock --mount type=tmpfs,destination=/tmp -v /sys/fs/cgroup:/sys/fs/cgroup:ro quay.io/footloose/fedora29:latest /sbin/init

@mcastelino
Copy link
Author

mcastelino commented Apr 8, 2019

Footloose as a Kubernetes POD. So a VM in Kubernetes launched and managed as a container using the Kata runtimeClass.

apiVersion: v1
kind: Pod
metadata:
  name: footfed
spec:
  runtimeClassName: kata
  volumes:
  - name: runv
    emptyDir:
      medium: "Memory"
  - name: runlockv
    emptyDir:
      medium: "Memory"
  - name: tmpv
    emptyDir:
      medium: "Memory"
  - name: fakecgroup
    hostPath:
      path: /sys/fs/cgroup
  containers:
  - name: footfed
    image: quay.io/footloose/fedora29:latest
    command: ["/sbin/init"]
    volumeMounts:
    - name: runv
      mountPath: /run
    - name: runlockv
      mountPath: /run/lock
    - name: tmpv
      mountPath: /tmp
    - name: fakecgroup
      readOnly: true
      mountPath: /sys/fs/cgroup

@mcastelino
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment