'Struggling with microk8s ingress and mapping
I have built a process using a series of docker containers to spool up quick and easy flutter apps into a kubernetes cluster (so I can use the rest of the cluster to run background worker type processes). I have been able to get it deployed to my microk8s but I'm really having trouble getting it all working without running the command:
kubectl port-forward service/flutterapp 8080:8080
When I do that, it runs an interactive console that I can see in my terminal and then am able to access the service on localhost:8080. I'm trying to set it to use localhost:80 though, so I've attempted to use various different ingress preconfigs I've found (such as istio, ha-proxy, ingress) but I will admit I'm a bit of a noob when it comes to k8s and networking in general. This is what I've come up with thus far (I've used a dummy image from one of the tutorials I have been reading to try to wrap my head around this). This is my basic yml:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: flutterapp
name: flutterapp
spec:
replicas: 2
selector:
matchLabels:
app: flutterapp
template:
metadata:
labels:
app: flutterapp
spec:
containers:
- name: flutterapp
image: gcr.io/kuar-demo/kuard-amd64:blue
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
name: http-flutterapp
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: flutterapp
spec:
ports:
- port: 8080
protocol: TCP
targetPort: http-flutterapp
selector:
app: flutterapp
sessionAffinity: None
type: LoadBalancer
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: flutterapp
spec:
rules:
- http:
paths:
- path: /flutterapp
pathType: Prefix
backend:
service:
name: flutterapp
port:
number: 8080
I assume I'm doing something stupid and obviously wrong, but some of the articles I read for this stuff are using extensions/v1beta1 or other various apis and I'm struggling to keep them all strait.
Any suggestions?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
