Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KubernetesのPetSetsの話

Kazuto Kusama
September 16, 2016

 KubernetesのPetSetsの話

社内コンテナ勉強会で喋った機能。
PetSetsを使うことで、従来のStatefulなアプリケーションもKubernetes上で動かしやすくなります

Kazuto Kusama

September 16, 2016
Tweet

More Decks by Kazuto Kusama

Other Decks in Technology

Transcript

  1. k8sͰී௨ʹ্͛ͨ৔߹
 (Deployments, Replication Controller) kind: Deployment metadata: name: rabbitmq spec:

    replicas: 3 template: metadata: labels: app: rabbitmq spec: containers: - name: rabbitmq image: rabbitmq:latest
  2. k8sͰී௨ʹ্͛ͨ৔߹
 (Deployments, Replication Controller) jacopen@ssh2:~/kubernetes$ kubectl get pods NAME READY

    STATUS RESTARTS AGE rabbitmq-4239234776-8bs65 1/1 Running 0 2m rabbitmq-4239234776-amzjt 1/1 Running 0 2m rabbitmq-4239234776-wq6s4 1/1 Running 0 2m
  3. $ rabbitmqctl join_cluster rabbit@rabbitmq-0 OR rabbitmq.config [ { rabbit, [

    {loopback_users, []}, {cluster_nodes, {[‘rabbit@rabbitmq-0', 'rabbit@rabbitmq-1'], ram}} ] } ].
  4. MQ MQ MQ ϝϯςͷͨΊʹఀࢭ͠Α͏ $ kubectl delete -f … rabbitmq-4239234776-8bs65

    rabbitmq-4239234776-amzjt rabbitmq-4239234776-wq6s4 Service rabbitmq-0 Service rabbitmq-1 Service rabbitmq-2 yaml yaml yaml yaml yaml yaml
  5. PetSetͰ্͛ͨ৔߹ jacopen@ssh2:~/kubernetes$ kubectl get pods NAME READY STATUS RESTARTS AGE

    rabbitmq-0 1/1 Running 0 18s rabbitmq-1 1/1 Running 0 12s rabbitmq-2 1/1 Running 0 7s
  6. root@rabbitmq-0:/# hostname rabbitmq-0 root@rabbitmq-0:/# 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 727: eth0@if728: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1350 qdisc noqueue state UP group default link/ether 02:42:ac:20:52:11 brd ff:ff:ff:ff:ff:ff inet 172.32.82.17/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::42:acff:fe20:5211/64 scope link tentative dadfailed valid_lft forever preferred_lft forever root@rabbitmq-0:/# ping rabbitmq-1.rabbitmq PING rabbitmq-1.rabbitmq.petset.svc.cluster.local (172.32.41.13) 56(84) bytes of data. 64 bytes from 172.32.41.13: icmp_seq=1 ttl=62 time=0.575 ms 64 bytes from 172.32.41.13: icmp_seq=2 ttl=62 time=0.752 ms