Hello I am quite new to kubernates I have used ad work but now I need to use it on premesis (I only have 1 machine),
So I have installed kubernates on an Ubuntu DPS
then I have also added ngnx-ingress-controller kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.35.0/deploy/static/provider/baremetal/deploy.yaml
then I have my deployment (react app):
apiVersion: apps/v1
kind: Deployment
metadata:
name: clientweb-dep
labels:
appcluster: ethernial
app: clientweb
spec:
replicas: 1
selector:
matchLabels:
app: clientweb
template:
metadata:
name: clientweb-template
labels:
appcluster: ethernial
app: clientweb
spec:
containers:
- name: clientweb
image: ethernial.azurecr.io/clientweb
resources:
requests:
cpu: 100m
memory: 300Mi
env:
- name: APPNAME
value: clientweb
- name: CONTAINERNAME
value: clientweb
ports:
- containerPort: 80
name: http-port
imagePullSecrets:
- name: acr-secret
and this is my servie:
apiVersion: v1
kind: Service
metadata:
labels:
appcluster: ethernial
app: clientweb
name: clientweb-service
spec:
ports:
- port: 80
name: http
selector:
app: clientweb
type: ClusterIP
and this is the ingress:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: clientweb-ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- http:
paths:
- path: /?(.*)
backend:
serviceName: clientweb-service
servicePort: 80
But when I got to the ip or domain URL I get 502 Bad Gateway (also I need to know how to configure domain or subdomains), so what I am missing?
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
clientweb-service ClusterIP 10.103.212.174 80/TCP 132m
kubernetes ClusterIP 10.96.0.1 443/TCP 48d
kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
clientweb-ingress * 62.75.216.101 80 31m
the address is the address of my DPS, and it is correct
kubectl describe ing clientweb-ingress
Name: clientweb-ingress
Namespace: default
Address: 62.75.216.101
Default backend: default-http-backend:80 (<error: endpoints “default-http-backend” not found>)
Rules:
Host Path Backends
---- ---- --------
*
/?(.*) clientweb-service:80 (10.244.0.21:80) <— is this wrong???
Annotations: kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CREATE 37m nginx-ingress-controller Ingress default/clientweb-ingress
Normal UPDATE 8m14s (x2 over 36m) nginx-ingress-controller Ingress default/clientweb-ingress