Docker Cookbook


Creating a Single-Node Kubernetes Cluster Using Docker Compose | 151



Download 6,31 Mb.
Pdf ko'rish
bet127/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   123   124   125   126   127   128   129   130   ...   260
Bog'liq
Docker Cookbook

5.9 Creating a Single-Node Kubernetes Cluster Using Docker Compose | 151


That is it. You now have a one-node Kubernetes 
cluster
with all components running
as containers; 
get nodes
returns your localhost, and you can create pods, replication
controllers, and services:
$ ./kubectl get nodes
NAME LABELS STATUS
127.0.0.1 Ready
To test that you can create a new pod, you are going to run a single Nginx container:
$ ./kubectl run-container nginx --image=nginx --port=80
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
nginx nginx nginx run-container=nginx 1
The 
run-container
command automatically creates a replication
controller for this container. List it with 
./kubectl get rc
.
To access this 
nginx
frontend from outside the cluster, you need to expose it as a ser‐
vice. However, when creating the service, you pass the host-only network IP of the
virtual machine to the 
kubectl
command. Otherwise, the service will be created, and
all future pods will be able to access it, but we will not be able to reach it from outside
the cluster:
$ ./kubectl expose rc nginx --port=80 --public-ip=192.168.33.10
NAME LABELS SELECTOR IP PORT
nginx run-container=nginx 10.0.0.98 80
Once the 
nginx
image is downloaded, the pod will enter running state and you will be
able to access the Nginx welcome page at 
http://192.168.33.10
:
$ ./kubectl get pods
POD IP CONTAINER(S) IMAGE(S) ...
nginx-127 controller-manager gcr.io/google_containers/...
apiserver gcr.io/google_containers/...
scheduler gcr.io/google_containers/...
nginx-461yi 172.17.0.6 nginx nginx ...
Discussion
The 
k8s.yml
Compose file shows how this was done:
etcd:
image: kubernetes/etcd:2.0.5.1
net: 
"host"
command: /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 \
--data-dir=/var/etcd/data
master:
image: gcr.io/google_containers/hyperkube:v0.14.1

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   123   124   125   126   127   128   129   130   ...   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