Docker 为什么可以';我还没到达这个舵图定义的应用程序吗?(在Minikube)

Docker 为什么可以';我还没到达这个舵图定义的应用程序吗?(在Minikube),docker,kubernetes,kubernetes-helm,minikube,Docker,Kubernetes,Kubernetes Helm,Minikube,我使用helm create helloworld chart使用我创建的本地docker映像创建了一个应用程序。我想问题是我把端口都弄乱了 码头工人作品 ------------------------------------ Docker文件 (我的index.html文件与我的Dockerfile文件位于同一目录下) 创建Docker映像(并在本地发布) 然后我用docker run-p8080:8008 hello world运行了这个程序,并验证了我能从localhost:8080访问

我使用
helm create helloworld chart
使用我创建的本地docker映像创建了一个应用程序。我想问题是我把端口都弄乱了

码头工人作品
------------------------------------

Docker文件

(我的
index.html
文件与我的
Dockerfile
文件位于同一目录下)

创建Docker映像(并在本地发布)

然后我用docker run-p8080:8008 hello world运行了这个程序,并验证了我能从localhost:8080访问它。(然后我停止了docker容器)

我还用docker image ls
docker本地验证了该图像,并得到了输出:

REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
hello-world                            latest              8640a285e98e        20 minutes ago      1.23MB
头盔片
------------------------------------

通过
头盔创建helloworld图表创建头盔图表

编辑文件:

值。yaml

#…被省略,因为保留与默认值相同。。。
图片:
存储库:你好,世界
标签:最新
pullPolicy:如果不存在
#…因保留与默认值相同而被删除。。。
服务:
姓名:你好,世界
类型:NodePort#选择此选项是因为MiniKube没有安装负载平衡器
外部端口:30007
内部端口:8008
港口:80
服务。yaml

#…被省略,因为保留与默认值相同。。。
规格:
类型:{{.Values.service.type}
端口:
-端口:{{.Values.service.port}
targetPort:{{.Values.service.internalPort}
节点端口:{{.Values.service.externalPort}
部署。yaml

#…被省略,因为保留与默认值相同。。。
规格:
#…因保留与默认值相同而被删除。。。
容器:
端口:
-名称:http
容器端口:{{.Values.service.internalPort}
协议:TCP
我用
helloworld图表
helloworld表格

舵手和MINIKUBE命令
------------------------------------

#包装我的头盔
头盔套装helloworld图表
#安装到Kuberneters(Minikube)中
舵手安装helloworld helloworld-chart-0.1.0.tgz
#获取外部IP
minikube服务helloworld helloworld图表
当我这样做时,它会给我一个像
http://172.23.13.145:30007
并在浏览器中打开,但只是说无法访问该网站。我有什么不匹配的

更新/更多信息 ---------------------------------------

当我检查pod时,它处于
CrashLoopBackOff
状态。但是,我在日志中没有看到任何内容:

kubectl日志-f helloworld-helloworld-chart-6c886d885b-grfbc

日志:


我不知道它为什么会退出。

问题是Minikube实际上在公共Docker图像回购中查找,并找到了一个也称为“你好世界”的东西。找不到我的docker映像,因为minikube的“本地”不是主机的docker的本地。Minikube有自己的docker在内部运行

  • 您必须将图像添加到minikube的本地repo:
    minikube缓存添加hello world:latest
  • 您需要更改拉动策略:
    imagePullPolicy:Never

  • 您可以通过
    http://localhost:30007
    ?您似乎只是为了您的服务导出了本地端口。如果您
    kubectl获得了pod
    ,pod是否已启动并运行?如果您
    kubectl在服务对象上描述服务
    ,它是否在描述的末尾显示至少一个
    端点:
    ?您的pod是否处于运行状态?netstat-nlt | grep:30007
    结果如何?我只是尝试复制相同的代码,并且能够使用这两种
    http://localhost:30007
    和minikue服务ip。@DavidMaze-Hmmm,有问题。我明白了:
    helloworld-helloworld-chart-6c886d885b-grfbc 0/1 CrashLoopBackOff 3
    @redInk我想这是活力探测器的问题?但我不知道如何正确设置。我在
    kubectl description pod…
    中看到:
    活跃度:http get http://:http/delay=0s timeout=1s period=10s#success=1#failure=3
    就绪:http get http://:http/delay=0s timeout=1s period=10s#success=1#failure=3
    ,我认为这意味着要检查的http路径是错误的
    docker build -t hello-world .
    
    REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
    hello-world                            latest              8640a285e98e        20 minutes ago      1.23MB
    
    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/