LoginSignup
4
4

More than 5 years have passed since last update.

復習: Running Kubernetes Example on CoreOS, Part 1

Last updated at Posted at 2014-07-30

Running Kubernetes Example on CoreOS, Part 2
https://coreos.com/blog/running-kubernetes-example-on-CoreOS-part-2/
が出たので、

Running Kubernetes Example on CoreOS, Part 1
http://coreos.com/blog/running-kubernetes-example-on-CoreOS-part-1/
を最新状態で、おさらいをしてみました。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "yungsang/coreos"

  config.vm.provision :shell do |s|
    s.inline = <<-EOT
      git clone https://github.com/kelseyhightower/kubernetes-coreos.git

      sudo cp kubernetes-coreos/units/download-kubernetes.service /etc/systemd/system/

      sudo cp kubernetes-coreos/units/apiserver.service /etc/systemd/system/
      sudo cp kubernetes-coreos/units/controller-manager.service /etc/systemd/system/
      sudo cp kubernetes-coreos/units/kubelet.service /etc/systemd/system/
      sudo cp kubernetes-coreos/units/proxy.service  /etc/systemd/system/

      sudo systemctl start etcd

      sudo systemctl start download-kubernetes

      sudo systemctl start apiserver
      sudo systemctl start controller-manager
      sudo systemctl start kubelet
      sudo systemctl start proxy
    EOT
  end
end
redis.json
{
  "id": "redis",
  "desiredState": {
    "manifest": {
      "version": "v1beta1",
      "id": "redis",
      "containers": [{
        "name": "redis",
        "image": "dockerfile/redis",
        "ports": [{
          "containerPort": 6379,
          "hostPort": 6379 
        }]
      }]
    }
  },
  "labels": {
    "name": "redis"
  }
}
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'yungsang/coreos'...
.
.
.
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: Cloning into 'kubernetes-coreos'...
==> default: Checking connectivity...
==> default: done
$ vagrant ssh
   ______                ____  _____
  / ____/___  ________  / __ \/ ___/
 / /   / __ \/ ___/ _ \/ / / /\__ \
/ /___/ /_/ / /  /  __/ /_/ /___/ /
\____/\____/_/   \___/\____//____/
(stable 367.1.0)
core@localhost ~ $ kubecfg -h http://127.0.0.1:8080 -c redis.json create /pods
I0730 23:03:58.785787 00732 request.go:220] Waiting for completion of /operations/1
I0730 22:37:09.176985 00741 request.go:220] Waiting for completion of /operations/1
I0730 22:37:29.180205 00741 request.go:220] Waiting for completion of /operations/1
.
.
.
Name                Image(s)            Host                Labels
----------          ----------          ----------          ----------
redis               dockerfile/redis    /                   name=redis

core@localhost ~ $ kubecfg -h http://127.0.0.1:8080 list /pods
Name                Image(s)            Host                Labels
----------          ----------          ----------          ----------
redis               dockerfile/redis    127.0.0.1/          name=redis

core@localhost ~ $ 
4
4
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4