takara9 / codes_for_lessons Goto Github PK
View Code? Open in Web Editor NEWThe code for lesson of Docker and Kubernetes
License: MIT License
The code for lesson of Docker and Kubernetes
License: MIT License
起きたエラーとその解決についてです。
step10/job_w_msg_broker/job-initiatorのDockerfileで
❯ docker build --tag job-init:0.1 .
Sending build context to Docker daemon 5.632kB
Step 1/8 : FROM ubuntu:16.04
---> fab5e942c505
Step 2/8 : RUN apt-get update && apt-get install -y iputils-ping dnsutils curl apt-transport-https
---> Using cache
---> 0b58283dca4a
Step 3/8 : RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
---> Using cache
---> 60f518ef63ea
Step 4/8 : RUN touch /etc/apt/sources.list.d/kubernetes.list
---> Using cache
---> 44b2cf6f7cd7
Step 5/8 : RUN echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
---> Using cache
---> 8fbf7875b01b
Step 6/8 : RUN apt-get update && apt-get install -y kubectl
---> Using cache
---> c2104daa4d32
Step 7/8 : RUN apt-get install -y python python-pip
---> Using cache
---> db0cf6cbd218
Step 8/8 : RUN pip install pika kubernetes
---> Running in 41b86f69832c
Collecting pika
Downloading https://files.pythonhosted.org/packages/a1/ae/8bedf0e9f1c0c5d046db3a7428a4227fe36ec1b8e25607f3c38ac9bf513c/pika-1.1.0-py2.py3-none-any.whl (148kB)
Collecting kubernetes
Downloading https://files.pythonhosted.org/packages/60/3f/2fef94fb65e8f94d768356e5fb9be222d18027e6167ccc65e2090917a771/kubernetes-11.0.0.tar.gz (724kB)
Collecting certifi>=14.05.14 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (156kB)
Collecting six>=1.9.0 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting python-dateutil>=2.5.3 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
Collecting setuptools>=21.0.0 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/2f/8e/38259f4a44944a92068d5ff77230511a4c685604b47a81318f9e5cf2cc24/setuptools-49.2.0.zip (2.2MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "setuptools/__init__.py", line 21, in <module>
import setuptools.version
File "setuptools/version.py", line 1, in <module>
import pkg_resources
File "pkg_resources/__init__.py", line 1380
raise SyntaxError(e) from e
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-XNeSDb/setuptools/
You are using pip version 8.1.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
のエラーが発生しました。
Dockerfileに
RUN pip install --upgrade pip
を追加することで解決できました。
// それまでは、HTTPS 200 OKを返します。
I think this is correct.
// それまでは、HTTPS 500 OKを返します。
テキストP.203~p.206(08.3 ロールアウト機能)の通りに、以下の通りに実行しております。
ロールアウト機能については概ね理解できたつもりなので、特別気になるほどではないですが、
結果がテキスト通りにはならなかったので記載させていただきます。
疑問1.操作1にてdiff を実行しても、結果がないのは、差分として扱われていないのでは?
疑問2. 操作4にて、unchangedとなるのは差分なしとされているからか?
操作1.
vagrant@master:~/codes_for_lessons/step08$ cp deployment2.yml deployment3.yml
操作2.
vagrant@master:~/codes_for_lessons/step08$ diff deployment2.yml deployment3.yml
操作3.
vagrant@master:~/codes_for_lessons/step08$ kubectl describe deployment web-deploy
Name: web-deploy
Namespace: default
CreationTimestamp: Tue, 05 May 2020 10:58:10 +0000
Labels: <none>
Annotations: deployment.kubernetes.io/revision: 1
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"web-deploy","namespace":"default"},"spec":{"replicas":10,...
Selector: app=web
Replicas: 10 desired | 10 updated | 10 total | 10 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=web
Containers:
nginx:
Image: nginx:1.16
Port: <none>
Host Port: <none>
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Progressing True NewReplicaSetAvailable
Available True MinimumReplicasAvailable
OldReplicaSets: <none>
NewReplicaSet: web-deploy-7c74bc9bb8 (10/10 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 5m15s deployment-controller Scaled up replica set web-deploy-7c74bc9bb8 to 3
Normal ScalingReplicaSet 3m23s deployment-controller Scaled up replica set web-deploy-7c74bc9bb8 to 10
操作4.
vagrant@master:~/codes_for_lessons/step08$ kubectl apply -f deployment3.yml
deployment.apps/web-deploy unchanged
テキスト通りに構築はできたのですが、疎通確認でうまくいっておりません。原因わかりますでしょうか。
お忙しいところ恐れ入ります。
Windows 10 ProfessionalEdition
32GB Memory
VirtualBox + Vagrant
vagrant@master:~/work/gitbucket/hide1227/codes_for_lessons/step13/url-mapping$ kubectl get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master Ready master 30d v1.14.10 172.16.20.11 <none> Ubuntu 18.04.6 LTS 4.15.0-187-generic docker://18.6.1
node1 Ready <none> 30d v1.14.10 172.16.20.12 <none> Ubuntu 18.04.6 LTS 4.15.0-187-generic docker://18.6.1
node2 Ready <none> 30d v1.14.10 172.16.20.13 <none> Ubuntu 18.04.6 LTS 4.15.0-187-generic docker://18.6.1
vagrant@master:~/work/gitbucket/hide1227/codes_for_lessons/step13/url-mapping$ kubectl get ing -o wide
NAME HOSTS ADDRESS PORTS AGE
hello-ingress abc.sample.com,xyz.sample.com 80, 443 25m
vagrant@master:~/work/gitbucket/hide1227/codes_for_lessons/step13/url-mapping$ kubectl get service -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
helloworld-svc NodePort 10.32.0.80 <none> 8080:31445/TCP 26m app=hello-world
java-svc ClusterIP 10.32.0.29 <none> 9080/TCP 26m app=liberty
kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 30d <none>
nginx-svc ClusterIP 10.32.0.240 <none> 9080/TCP 26m app=nginx
vagrant@master:~/work/gitbucket/hide1227/codes_for_lessons/step13/url-mapping$ kubectl get deploy -o wide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
helloworld-deployment 1/1 1 1 26m hello-world-container strm/helloworld-http app=hello-world
java-deployment 1/1 1 1 26m open-liberty openliberty/open-liberty:javaee8-ubi-min-amd64 app=liberty
nginx-deployment 3/3 3 3 26m nginx nginx app=nginx
vagrant@master:~/work/gitbucket/hide1227/codes_for_lessons/step13/url-mapping$ kubectl get rs -o wide
NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
helloworld-deployment-88fd567c 1 1 1 26m hello-world-container strm/helloworld-http app=hello-world,pod-template-hash=88fd567c
java-deployment-58c597d687 1 1 1 26m open-liberty openliberty/open-liberty:javaee8-ubi-min-amd64 app=liberty,pod-template-hash=58c597d687
nginx-deployment-56db997f77 3 3 3 26m nginx nginx app=nginx,pod-template-hash=56db997f77
vagrant@master:~/work/gitbucket/hide1227/codes_for_lessons/step13/url-mapping$ kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
helloworld-deployment-88fd567c-c7b8n 1/1 Running 0 26m 10.244.1.21 node1 <none> <none>
java-deployment-58c597d687-8gczp 1/1 Running 0 26m 10.244.1.23 node1 <none> <none>
nginx-deployment-56db997f77-88x7p 1/1 Running 0 26m 10.244.1.22 node1 <none> <none>
nginx-deployment-56db997f77-944zz 1/1 Running 0 26m 10.244.2.13 node2 <none> <none>
nginx-deployment-56db997f77-rpd4l 1/1 Running 0 26m 10.244.2.14 node2 <none> <none>
vagrant@master:~/work/gitbucket/hide1227/codes_for_lessons/step13/url-mapping$
Windows10 側で Chromeブラウザでの疎通確認は以下の状況です。
http://abc.sample.com/
⇒ 疎通せず。
http://abc.sample.com:31445/
⇒ 疎通します。
https://abc.sample.com/
⇒ 疎通せず。
http://abc.sample.com:31445/apl2/
⇒ 疎通せず。
http://xyz.sample.com:31445/
⇒ 疎通するが、helloworld-deployment が出てきてしまう。
http://xyz.sample.com/
⇒ 疎通せず。
P262のpythonのコードが上手く動作しなかったため、一度ご確認いただきたいです。
おこなった内容はminikube上で
$kubectl apply -f taskQueue-deploy
$docker build --tag job-init:0.1 ./job-initiator.py
$docker run -it --rm --name kube -v `pwd`/py:/py -v ~/.kube:/root/.kube -v ~/.minikube:/Users/[user名]/.minikube job-init:0.1 bash
コンテナを起動した後
root@ddbfd700e12c:/# cd py
root@ddbfd700e12c:/py# python job-initiator.py
Traceback (most recent call last):
File "job-initiator.py", line 64, in <module>
queue = create_queue()
File "job-initiator.py", line 21, in create_queue
conn = pika.BlockingConnection(qmgr_pram)
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 359, in __init__
self._impl = self._create_connection(parameters, _impl_class)
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 450, in _create_connection
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.AMQPConnectionError
以上の内容のエラーが出ております。
liberatorのイメージをビルド中に、エラーが発生する
$ docker build --tag gyuki1029/liberator:0.1 .
Sending build context to Docker daemon 5.12kB
Step 1/7 : FROM ubuntu:16.04
16.04: Pulling from library/ubuntu
8e097b52bfb8: Pull complete
・
・
・
Step 4/7 : RUN pip install kubernetes
---> Running in f3e762382fea
Collecting kubernetes
Downloading https://files.pythonhosted.org/packages/60/3f/2fef94fb65e8f94d768356e5fb9be222d18027e6167ccc65e2090917a771/kubernetes-11.0.0.tar.gz (724kB)
Collecting certifi>=14.05.14 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (156kB)
Collecting six>=1.9.0 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting python-dateutil>=2.5.3 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
Collecting setuptools>=21.0.0 (from kubernetes)
Downloading https://files.pythonhosted.org/packages/38/cc/db23dbe4efc464c3c0111fedf7d46de8888f05b09488d610f6f8ab6e2544/setuptools-49.6.0.zip (2.2MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "setuptools/__init__.py", line 19, in <module>
import setuptools.version
File "setuptools/version.py", line 1, in <module>
import pkg_resources
File "pkg_resources/__init__.py", line 1380
raise SyntaxError(e) from e
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-EgwRl7/setuptools/
You are using pip version 8.1.1, however version 20.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install kubernetes' returned a non-zero code: 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.