http://blog.gachapin-sensei.com/archives/5174099.html
この記事を読んで面白かったので、rktを触ってみたいと思ったんです。
準備
まずは、vagrant と VirtualBOX をインストールします。
次にrktをgitでcloneします
git clone https://github.com/coreos/rkt
vagrantを立ち上げる
vagrant upします
% vagrant up (git)-[master]
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20170209.0.0'. The latest is version '20170217.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: ubuntu
default: SSH auth method: password
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.0.32
default: VirtualBox Version: 5.1
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/shiotaro/CoreOS/rkt
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
立ち上がったら vagrant ssh します。
% vagrant ssh (git)-[master]
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-62-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
18 packages can be updated.
10 updates are security updates.
rkt runをする
基本的にrootで行うコマンドはsudoをしてという思想ですので、sudoを活用します。
rktでnginxを立ち上げます。
$ sudo rkt run --net=host --insecure-options=image docker://nginx
http://172.28.128.3
にアクセスするとnginxが動いていることがわかります。
Kubernetes を利用する
次回はKubernetesを利用してコンテナを管理してみたいと思います。