You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rem 社外にnpmするよう設定
npm config set proxy http://myproxy:8080
npm config set https-proxy http://myproxy:8080
npm config set strict-ssl false
rem npm config set registry http://local/artifactory/api/npm/npm-virtual/
npm config list
>minikube start
E0619 16:11:43.180199 10144 start.go:529] StartHost: create: creating: Unable to start the VM: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm minikube --type headless
failed:
VBoxManage.exe: error: The native API dll was not found (C:\Windows\system32\WinHvPlatform.dll) (VERR_NEM_NOT_AVAILABLE).
VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
Details: 00:00:02.382753 Power up failed (vrc=VERR_VMX_MSR_ALL_VMX_DISABLED, rc=E_FAIL (0X80004005))
X Unable to start VM: create: creating: Unable to start the VM: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe startvm minikube --type headless failed:
VBoxManage.exe: error: The native API dll was not found (C:\Windows\system32\WinHvPlatform.dll) (VERR_NEM_NOT_AVAILABLE).
VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
Details: 00:00:02.382753 Power up failed (vrc=VERR_VMX_MSR_ALL_VMX_DISABLED, rc=E_FAIL (0X80004005))
* Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
- https://github.com/kubernetes/minikube/issues/new
実行NG:docker version
`docker daemon is not running.`と出る場合はminikubeが起動してない可能性があります
[Kubernetesクラスタの起動](#Kubernetesクラスタの起動)を再実施してください
エラー
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: c89750f8
Built: 06/09/2019 17:10:42
OS/Arch: windows/amd64
Experimental: false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version: o
pen //./pipe/docker_engine: The system cannot find the file specified. In the de
fault daemon configuration on Windows, the docker client must be run elevated to
connect. This error may also indicate that the docker daemon is not running.
クラスタの状況確認
kubectl cluster-info
実行結果
下記の様に表示されればOK
>kubectl cluster-info
Kubernetes master is running at https://192.168.99.102:8443
KubeDNS is running at https://192.168.99.102:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
クラスタのノード情報確認
kubectl get nodes
実行結果
下記の様に表示されればOK
>kubectl get node
NAME STATUS ROLES AGE VERSION
minikube Ready master 178m v1.14.2
>minikube start
* minikube v1.1.0 on windows (amd64)
* Downloading Minikube ISO ...
131.28 MB / 131.28 MB [============================================] 100.00% 0s
* Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
* Found network options:
- HTTP_PROXY=myproxy:8080
- HTTPS_PROXY=myproxy:8080
- NO_PROXY=127.0.0.1,192.168.99.100,192.168.99.102,192.168.99.103
* Configuring environment for Kubernetes v1.14.2 on Docker 18.09.6
- env HTTP_PROXY=myproxy:8080
- env HTTPS_PROXY=myproxy:8080
- env NO_PROXY=127.0.0.1,192.168.99.100,192.168.99.102,192.168.99.103
* Downloading kubelet v1.14.2
* Downloading kubeadm v1.14.2
* Pulling images ...
* Launching Kubernetes ...
* Verifying: apiserver proxy etcd scheduler controller dns
* Done! kubectl is now configured to use "minikube"
dockerの残骸などを削除していてVMのminikubeを消したら動かなくなった
minikube環境のリフレッシュ
minikube delete
minikube start
で復旧
実行確認
C:\WINDOWS\system32>minikube version
minikube version: v1.1.1
C:\WINDOWS\system32>kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
C:\WINDOWS\system32>@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i
C:\WINDOWS\system32>docker version
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: c89750f8
Built: 06/09/2019 17:10:42
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.6
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 02:41:08 2019
OS/Arch: linux/amd64
Experimental: false
クラスタの状況確認
>kubectl cluster-info
Kubernetes master is running at https://192.168.99.102:8443
KubeDNS is running at https://192.168.99.102:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
IPが100ではなくて102になってるのが、気になるがOKとする
クラスタのノード情報確認
>kubectl get node
NAME STATUS ROLES AGE VERSION
minikube Ready master 178m v1.14.2
>kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 178m v1.14.3
Dockerコマンドの有効化
@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%iによって、minikubeのdockerを操作できるようになります。
コンソール起動毎に実施してください
実行結果
文言なし、もしくは下記のような文言であればOK
>@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i
There is a newer version of minikube available (v1.2.0). Download it here:
https://github.com/kubernetes/minikube/releases/tag/v1.2.0
To disable this notification, run the following:
minikube config set WantUpdateNotification false
mkdir -p .\workspace_k8s\nginxpage
cd .\workspace_k8s\nginxpage
echoserver
最も簡単なKubernetesサンプルの実行
echoserverを構築してみる
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
kubectl expose deployment hello-minikube --type=NodePort --port=8080
minikube service hello-minikube
minikube service list
kubectl get deploy hello-minikube -o yaml
kubectl get service
kubectl get pods
削除
kubectl delete service hello-minikube
kubectl delete deployment hello-minikube
kubectl get service
kubectl get pods
```
>kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-kubernetes-69b545884f-fzdnr 0/1 ImagePullBackOff 0 103s
```
デプロイなどのイベントログ確認(うまく動作してない場合はここで確認する)
kubectl get events
実行OK
>kubectl get events
LAST SEEN TYPE REASON OBJECT MESSAGE
4m14s Normal Scheduled pod/hello-kubernetes-69b545884f-fzdnr Successfully assigned default/hello-kubernetes-69b545884f-fzdnr to minikube
4m12s Normal Pulling pod/hello-kubernetes-69b545884f-fzdnr Pulling image "gcr.io/hello-minikube-zero-install/hello-node"
4m10s Normal Pulled pod/hello-kubernetes-69b545884f-fzdnr Successfully pulled image "gcr.io/hello-minikube-zero-install/hello-node"
4m10s Normal Created pod/hello-kubernetes-69b545884f-fzdnr Created container hello-node
4m9s Normal Started pod/hello-kubernetes-69b545884f-fzdnr Started container hello-node
4m14s Normal SuccessfulCreate replicaset/hello-kubernetes-69b545884f Created pod: hello-kubernetes-69b545884f-fzdnr
4m14s Normal ScalingReplicaSet deployment/hello-kubernetes Scaled up replica set hello-kubernetes-69b545884f to 1
podの詳細状況確認
kubectl describe pod {POD NAME}
実行OK例
例`kubectl describe pod hello-kubernetes-b89fcc69b-cnwj2`
>kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-kubernetes LoadBalancer 10.106.90.5 <pending> 8080:32374/TCP 45s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19d
「NAME」列の値がhello-kubernetesの行があることを確認します
確認
モジュールの動作確認
minikube service hello-kubernetes
実行結果
下記の様に表示されればOK
>minikube service hello-kubernetes
* Opening kubernetes service default/hello-kubernetes in default browser...
Browerが立ち上がって、Hello World!が表示されます。
もしくはkubectl get serviceのhello-kubernetesの行から、
http://{起動時に表示されるIP}/[PORT(左)] でアクセスします
例http://192.168.99.100:32374/
Serviceとして動作している一覧取得
minikube service list
実行結果
下記の様に表示されればOK
>minikube service list
|-------------|----------------------|-----------------------------|
| NAMESPACE | NAME | URL |
|-------------|----------------------|-----------------------------|
| default | hello-kubernetes | http://192.168.99.100:32374 |
| default | kubernetes | No node port |
| kube-system | kube-dns | No node port |
| kube-system | kubernetes-dashboard | No node port |
|-------------|----------------------|-----------------------------|
Serviceの稼働状況一覧取得
kubectl get service
実行結果
下記の様に表示されればOK
>kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-kubernetes LoadBalancer 10.106.90.5 <pending> 8080:32374/TCP 7m16s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 20d
>docker run -it --rm hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
>docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 6 months ago 1.84kB
FROM nginx:1.11
COPY page.html /usr/share/nginx/html/page.html
page.htmlファイル作成
<html>
<head><title>this is page</title></head>
<body>original page</body>
</html>
imageを作る
タグはlatestだと動かないので、適当にバージョンつけます。
cd .\workspace_k8s\nginxpage
docker build --rm -t local/example/nginxpage:0.1.0 .
実行結果
下記の様に表示されればOK
Sending build context to Docker daemon 13.31kB
Step 1/2 : FROM nginx:1.11
---> 5766334bdaa0
Step 2/2 : COPY page.html /usr/share/nginx/html/page.html
---> Using cache
---> 436dd667181f
Successfully built 436dd667181f
Successfully tagged local/example/nginxpage:0.1.0
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
>docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 6 months ago 1.84kB
local/example/nginxpage 0.0.1 425b5b583a28 2 weeks ago 183MB
nginx 1.11 5766334bdaa0 2 years ago 183MB
構築
kubectl create deployment nginxpage --image=local/example/nginxpage:0.1.0
rem PCからアクセスできるように
kubectl expose deployment nginxpage --name=nginxpage-service --type="NodePort" --port=80
rem ブラウザで確認
minikube service nginxpage-service
実行結果
下記の様に表示されればOK
>kubectl create deployment nginxpage --image=local/example/nginxpage:0.1.0
deployment.apps/nginxpage created
>kubectl expose deployment nginxpage --name=nginxpage-service --type="NodePort" --port=80
service/nginxpage-service exposed
>minikube service nginxpage-service
* Opening kubernetes service default/nginxpage-service in default browser...
kubectl create -f nginxpage.yaml
minikube service nginxpage-service
実行OK
>kubectl create -f nginxpage.yaml
pod/nginxpage created
service/nginxpage-service created
>minikube service nginxpage-service
* Opening kubernetes service default/nginxpage-service in default browser...
>kubectl create -f nginxpage.yaml
service/nginxpage-service created
Error from server (AlreadyExists): error when creating "nginxpage.yaml": pods "nginxpage" already exist
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
削除
kubectl delete -f nginxpage.yaml
kubectl get service
kubectl get pods
実行OK
>kubectl create -f nginxpage.yaml
pod/nginxpage created
service/nginxpage-service created
>minikube service nginxpage-service
* Opening kubernetes service default/nginxpage-service in default browser...
>kubectl delete -f nginxpage.yaml
pod "nginxpage" deleted
service "nginxpage-service" deleted
>kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 20d
>kubectl get pods
No resources found.
rem skaffold dev --default-repo <myrepo>
start skaffold dev --default-repo local
minikube service nginxpage-service
実行OK
�[34mGenerating tags...�[0m
�[34m - local/local_example_nginxpage -> �[0mtime="2019-07-04T19:23:38+09:00" level=warning msg="Unable to find git commit: Running [git describe --tags --always]: stdout , stderr: fatal: not a git repository (or any of the parent directories): .git\n, err: exit status 128: exit status 128"
local/local_example_nginxpage:dirty
�[34mTags generated in 962ms�[0m
�[34mStarting build...�[0m
�[34mFound [minikube] context, using local docker daemon.
�[0m�[34mBuilding [local/local_example_nginxpage]...
�[0mSending build context to Docker daemon 3.072kB
Step 1/2 : FROM nginx:1.11
---> 5766334bdaa0
Step 2/2 : COPY page.html /usr/share/nginx/html/page.html
---> Using cache
---> 57d97e81bc1d
Successfully built 57d97e81bc1d
Successfully tagged local/local_example_nginxpage:dirty
�[34mBuild complete in 72ms�[0m
�[34mStarting test...�[0m
�[34mTest complete in 0s�[0m
�[34mStarting deploy...�[0m
�[34mkubectl client version: 1.14�[0m
pod/nginxpage unchanged
service/nginxpage-service unchanged
�[34mDeploy complete in 16.651s�[0m
�[33mWatching for changes every 1s...
�[0m
確認
http://{IP}:{port}/page.html
にアクセス
original page
となっていることを確認
page.htmlファイルを修正
<html>
<head><title>this is page</title></head>
<body>update page</body>
</html>
確認
http://{IP}:{port}/page.html
にアクセス
update page
に更新されたことを確認
skaffold -v debug dev
time="2019-06-21T00:30:25+09:00" level=fatal msg="watching files for artifact local/exsample/tomcat-app: listing files: listing files: file pattern [target/classes] must match at least one file"
docker info
docker build --tag local/exsample/tomcat-app:0.0.1 .
docker image ls
rem docker export --output="latest.tar" local/exsample/tomcat-app
docker save --output="latest.tar" local/exsample/tomcat-app
cd /d D:\devs\workspace_k8s\hello-node
@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i
docker build --rm -t example/hello-node:0.1.0 .
docker tag example/hello-node 192.168.99.101:30470/hello-node
docker push 192.168.99.101:30470/hello-node
>docker push 192.168.99.101:30470/hello-node
The push refers to repository [192.168.99.101:30470/hello-node]
Get https://192.168.99.101:30470/v2/: EOF
構築
kubectl create deployment hello-node --image=192.168.99.101:30470/hello-node
rem kubectl run hello-node --image=example/hello-node --image-pull-policy=IfNotPresent
kubectl expose deployment hello-node --type=LoadBalancer --port=8080
minikube service hello-node
動かない
削除
kubectl delete service hello-node
kubectl delete deployment hello-node
kubectl get service
kubectl get pods
kubectl get events
nginxロードバランサ 作成
作成
@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i
kubectl create deployment nginx --image=nginx:1.15.8
kubectl get pods
kubectl get deployment
kubectl expose deployment nginx --port 80 --type LoadBalancer
kubectl get service
minikube service nginx
削除
kubectl delete service nginx
kubectl delete deployment nginx
kubectl get service
kubectl get pods
>minikube dashboard
* Enabling dashboard ...
* Verifying dashboard health ...
* Launching proxy ...
* Verifying proxy health ...
X http:///api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/ is not responding properly: checkURL: Get http:///api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/: http: no Host in request URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i
rem docker build ./ -t dev
docker pull visv/eclipse
3.「Dockerコンテナ」の作成&起動
ipconfig
docker run -it -e DISPLAY=<ホストのIPアドレス>:0.0 dev
docker run -it -e DISPLAY=192.168.0.1:0.0 dev
docker run -it --rm -v eclipseRepo:/root/repo -v eclipseWorkspace:/root/eclipse-workspace -e DISPLAY=192.168.0.1:0.0 visv/eclipse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i
docker run -p 5000:5000 -d stackbrew/registry
rem docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker run -d -p 5000:5000 -v /var/registry:/tmp/registry stackbrew/registry
停止
docker ps
docker stop nervous_yonath
kubaで作成
作成
@FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i
kubectl create deployment registry --image=stackbrew/registry
kubectl get pods
kubectl get deployment
kubectl expose deployment registry --port=5000 --type="NodePort"
kubectl get service
minikube service registry
削除
kubectl delete service registry
kubectl delete deployment registry
kubectl get service
kubectl get pods
rem kubectl run nginxpage --image=example/nginxpage:0.1.0 --port=80
kubectl create deployment nginxpage --image=example/nginxpage:0.1.0
2m33s Warning Failed pod/hello-node-5f97f4df7d-rfqmk Failed to pull image "example/hello-node": rpc error: code = Unknown desc = Error response from daemon: pull access denied for example/hello-node, repository does not exist or may require 'docker login'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$NO_PROXY がもっとサンプルだとわかりやすい値に変更