Docker Cookbook


Using fleet to Start Containers on a CoreOS Cluster | 179



Download 6,31 Mb.
Pdf ko'rish
bet147/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   143   144   145   146   147   148   149   150   ...   260
Bog'liq
Docker Cookbook

6.4 Using fleet to Start Containers on a CoreOS Cluster | 179


Jan 12 22:06:21 core-02 ...[cluster.service ] [Wendigo] new_master [Wendigo]...
Jan 12 22:06:21 core-02 ...[http ] [Wendigo] bound_address ...
Jan 12 22:06:21 core-02 ...[node ] [Wendigo] started
Jan 12 22:06:21 core-02 ...[gateway ] [Wendigo] recovered [0] ...
See Also
• Launching containers with 
fleet
6.5 Deploying a flannel Overlay Between CoreOS Instances
Contributed by Eugene Yakubovich
Problem
You have a CoreOS cluster and would like Docker containers to communicate using
overlay networking instead of port forwarding.
Solution
Set up 
flannel
on all of the CoreOS instances. Include the following snippet in your
cloud-config
as part of CoreOS provisioning:
#cloud-config
coreos:
units:
- name: flanneld.service
drop-ins:
- name: 50-network-config.conf
content: |
[Service]
ExecStartPre=/usr/bin/etcdctl set \
/coreos.com/network/config \
'{ "Network": "10.1.0.0/16" }'
command: start
Make sure to pick an IP address range that is unused by your orga‐
nization. 
flannel
uses 
etcd
for coordination. Be sure that you also
follow the recipe to set up an 
etcd
cluster.
Make sure your security policy allows traffic on UDP port 8285. Start three CoreOS
instances and wait for 
flannel
to initialize. You can use the 
ifconfig
utility to check
that the 
flannel0
interface is up:
180 | Chapter 6: Optimized Operating System Distributions for Docker


$ ifconfig
flannel0: flags=81 mtu 1472
inet 10.1.77.0 netmask 255.255.0.0 destination 10.1.77.0
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen ...
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Next, run a container to print out its IP address and listen on TCP port 8000:
$ docker run -it --rm busybox /bin/sh -c \
"ifconfig eth0 && nc -l -p 8000"
eth0 Link encap:Ethernet HWaddr 02:42:0A:01:4D:03
inet addr:10.1.77.3 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST MTU:1472 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:234 (234.0 B) TX bytes:90 (90.0 B)
Take note of the IP address reported by 
ifconfig
. Other containers that are part of
the 
flannel
network can use this IP to reach this container. On a different host, run a
container to send a string to the listener:
$ docker run -it --rm busybox /bin/sh -c \
"echo Hello, container | nc 10.1.77.3 8000"
The first container will print out “Hello, container” and exit.
When you add more items to the 
units
section of 
cloud-config
, be
sure that any services that start Docker containers are listed after
flanneld.service
. Since units are processed in order, this will
ensure that 
flannel
is ready prior to containers starting.

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   143   144   145   146   147   148   149   150   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish