I created a container that has apache, php, and mysql on it.
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: apachephp7mysql8
name: apachephp7mysql8
spec:
replicas: 1
selector:
matchLabels:
app: apachephp7mysql8
tier: frontend
template:
metadata:
labels:
app: apachephp7mysql8
tier: frontend
spec:
containers:
- image: apachephp7mysql8:latest
name: apachephp7mysql8
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: apachephp7mysql8
namespace: default
labels:
app: apachephp7mysql8
spec:
type: NodePort
ports:
- port: 80
name: http
targetPort: 80
protocol: TCP
selector:
app: apachephp7mysql8
---
apiVersion: v1
kind: Service
metadata:
name: apachephp7mysql8
namespace: kube-system
spec:
type: ExternalName
externalName: apachephp7mysql8.default.svc.cluster.local
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: apachephp7mysql8
namespace: kube-system
spec:
rules:
- host: apachephp7mysql8.test
http:
paths:
- path: /
backend:
serviceName: apachephp7mysql8
servicePort: 80
Inside my container I try to connect to mysql via localhost. This no longer works once I deploy my app to minikube.
How can I connect to the container's localhost?
*I am aware this is not the best design however it is specific to this app.
Read more here: https://stackoverflow.com/questions/65044497/minikube-from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost
Content Attribution
This content was originally published by MontrealDevOne at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.