我用过
helm create helloworld-chart
使用我创建的本地docker映像创建应用程序。我想问题是我把端口都弄乱了。
码头工人
--------------------------
FROM busybox
ADD index.html /www/index.html
EXPOSE 8008
CMD httpd -p 8008 -h /www; tail -f /dev/null
(我还有一个
index.html
Dockerfile
)
docker build -t hello-world .
docker run -p 8080:8008 hello-world
我证实了
能够从本地主机:8080。
(然后我停下了码头集装箱)
我还验证了这张图片在docker本地
docker image ls
得到了结果:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 8640a285e98e 20 minutes ago 1.23MB
--------------------------
通过创建舵图
掌舵创建地狱世界图
# ...elided because left the same as default...
image:
repository: hello-world
tag: latest
pullPolicy: IfNotPresent
# ...elided because left the same as default...
service:
name: hello-world
type: NodePort # Chose this because MiniKube doesn't have LoadBalancer installed
externalPort: 30007
internalPort: 8008
port: 80
服务.yaml
# ...elided because left the same as default...
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.internalPort }}
nodePort: {{ .Values.service.externalPort }}
部署.yaml
# ...elided because left the same as default...
spec:
# ...elided because left the same as default...
containers:
ports:
- name: http
containerPort: {{ .Values.service.internalPort }}
protocol: TCP
helm lint helloworld-chart
和
helm template ./helloworld-chart
# Packaging my helm
helm package helloworld-chart
# Installing into Kuberneters (Minikube)
helm install helloworld helloworld-chart-0.1.0.tgz
# Getting an external IP
minikube service helloworld-helloworld-chart
当我这么做的时候,它会给我一个外部ip,就像
http://172.23.13.145:30007
并在浏览器中打开,但只是说无法访问该网站。我有什么不匹配的?
更新/更多信息
---------------------------------------
当我检查吊舱时,它在一个
CrashLoopBackOff
州。但是,我在日志中什么也没看到:
kubectl logs -f helloworld-helloworld-chart-6c886d885b-grfbc
日志:
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/