1
votes

I've used helm create helloworld-chart to create an application using a local docker image I created. i think the issue is that i have the ports all messed up.

DOCKER PIECES
--------------------------

Docker File

FROM busybox
ADD index.html /www/index.html
EXPOSE 8008
CMD httpd -p 8008 -h /www; tail -f /dev/null

(I also have an index.html file in the same directory as my Dockerfile)

Create Docker Image (and publish locally)

docker build -t hello-world .

I then ran this with docker run -p 8080:8008 hello-world and verified I am able to reach it from localhost:8080. (I then stopped that docker container)

I also verified this image was in docker locally with docker image ls and got the output:

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

HELM PIECES
--------------------------

Created a helm chart via helm create helloworld-chart.

Edited the files:

values.yaml

# ...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

service.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 }}

deployment.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

I verified this "looked" correct with both helm lint helloworld-chart and helm template ./helloworld-chart

HELM AND MINIKUBE COMMANDS
--------------------------

# 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

When I do that, it gives me an external ip like http://172.23.13.145:30007 and opens in a browser but just says the site cannot be reached. What do i have mismatched?

UPDATE/MORE INFO ---------------------------------------

When I check the pod, it's in a CrashLoopBackOff state. However, I see nothing in the logs:

kubectl logs -f helloworld-helloworld-chart-6c886d885b-grfbc

Logs:

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/

I'm not sure why it's exiting.

1
Can you access thru http://localhost:30007? It seems you just export your local port for your service.Gawain
If you kubectl get pods, is the pod up and running? If you kubectl describe service on the service object, does it show at least one endpoints: at the end of the description?David Maze
Is your pod in running state? what about the netstat -nlt | grep ':30007' result? I just tried to replicate the same and able to access with bothhttp://localhost:30007 and minikue service ip.redInk
@DavidMaze Hmmm, there is a problem. i see: helloworld-helloworld-chart-6c886d885b-grfbc 0/1 CrashLoopBackOff 3Don Rhummy
@redInk I think it's a problem with the liveness probe? but I'm not sure how to set this properly. I see in kubectl describe pod...: Liveness: http-get http://:http/ delay=0s timeout=1s period=10s #success=1 #failure=3 and Readiness: http-get http://:http/ delay=0s timeout=1s period=10s #success=1 #failure=3 which I assume means that's the wrong http paths to checkDon Rhummy

1 Answers

2
votes

The issue was that Minikube was actually looking in the public Docker image repo and finding something also called hello-world. It was not finding my docker image since "local" to minikube is not local to the host computer's docker. Minikube has its own docker running internally.

  1. You have to add your image to minikube's local repo: minikube cache add hello-world:latest.
  2. You need to change the pull policy: imagePullPolicy: Never