I am running minikube on MacOS, and want to expose the ip address and port for running this example helm chart - https://docs.bitnami.com/kubernetes/how-to/create-your-first-helm-chart/
I tried to ping the localhost:58064, but it wouldn't connect.
helm install --dry-run --debug ./mychart --set service.internalPort=8080
[debug] Created tunnel using local port: '58064'
[debug] SERVER: "127.0.0.1:58064"
[debug] Original chart version: ""
[debug] CHART PATH: /Users/me/Desktop/HelmTest/mychart
NAME: messy-penguin
REVISION: 1
RELEASED: Tue Jun 12 17:56:41 2018
CHART: mychart-0.1.0
USER-SUPPLIED VALUES:
service:
internalPort: 8080
COMPUTED VALUES:
affinity: {}
image:
pullPolicy: IfNotPresent
repository: nginx
tag: stable
ingress:
annotations: {}
enabled: false
hosts:
- chart-example.local
path: /
tls: []
nodeSelector: {}
replicaCount: 1
resources: {}
service:
internalPort: 8080
port: 80
type: ClusterIP
tolerations: []
HOOKS:
MANIFEST:
---
# Source: mychart/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: messy-penguin-mychart
labels:
app: mychart
chart: mychart-0.1.0
release: messy-penguin
heritage: Tiller
spec:
type: ClusterIP
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
app: mychart
release: messy-penguin
---
# Source: mychart/templates/deployment.yaml
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: messy-penguin-mychart
labels:
app: mychart
chart: mychart-0.1.0
release: messy-penguin
heritage: Tiller
spec:
replicas: 1
selector:
matchLabels:
app: mychart
release: messy-penguin
template:
metadata:
labels:
app: mychart
release: messy-penguin
spec:
containers:
- name: mychart
image: "nginx:stable"
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{}
MacBook-Pro:~/Desktop/HelmTest quantum-fusion$ curl 127.0.0.1:58064
curl: (7) Failed to connect to 127.0.0.1 port 58064: Connection refused
Because minikube
is from the docker-machine family, running minikube ip
will output the IP address of the virtual machine, and that is the IP upon which you should attempt to contact your cluster, not localhost.
Furthermore, [debug] Created tunnel using local port: '58064'
is helm making a tunnel to the embedded tiller
Pod inside your cluster, and is not anything that you should be using at all. That's actually why it is prefixed with [debug]
: because it is only useful for extreme circumstances.
Finally, you will need to use kubectl port-forward
to reach your deployed Pod since the Service
is using a ClusterIP
, which as its name implies is only valid inside the cluster. You can also create a second Service
of type: NodePort
and it will allocate a TCP/IP port on the virtual machine's IP that routes to the port:
of the Service
. You may be able to inform your Helm chart to do that for you, depending on whether the author exposed that kind of decision through the chart's values.yaml
.
The other "asterisk" to that port-forward
versus Service
of type: NodePort
part is that I see in the output a mention of an Ingress
resource for chart-example.local
, but that pragmatically is only meaningful if you have a running "ingress controller," but if you do, then it already has a TCP/IP port upon which you should contact your cluster, just ensuring that you provide the connection with a curl -H "host: chart-example.local" http://$(minikube ip):${the_ingress_port}
so that the ingress controller can route the request to the correct Ingress
.