I'm using "Docker Desktop for Windows" with kube.netes. So far, its great.
I'd like to manage my postgress db (TCP:5432). I'm using the kube.netes "ingress-nginx" ingress controller, which saws it can be configured to expose TCP using a configmap .
Here is what I have so far:
apiVersion: v1
kind: ConfigMap
metadata:
name: tcp-services
namespace: ingress-nginx
data:
5432: "ingress-nginx/postgres:5432"
---
# SEE: https://kubernetes.io/docs/concepts/services-networking/ingress/
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-myproject.com
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: clusterissuer-selfsigned
# See: https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
spec:
tls:
- hosts:
- www.myproject.com
secretName: tls-myproject
rules:
# Avoid Quasar build paths: /css, /fonts, /icons, /js
- http:
paths:
# See https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md
- path: /data(/|$)(.*)
pathType: Prefix
backend:
service:
name: backend
port:
number: 80
...
Now I need to:
I found the ingress-nginx-controller in the kube.netes dashboard and hand edited like below, but it's behavior didn't change.
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
template:
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
spec:
volumes:
- name: webhook-cert
secret:
secretName: ingress-nginx-admission
defaultMode: 420
containers:
- name: controller
image: >-
k8s.gcr.io/ingress-nginx/controller:v0.41.0@sha256:e6019e536cfb921afb99408d5292fa88b017c49dd29d05fc8dbc456aa770d590
args:
- /nginx-ingress-controller
- '--publish-service=$(POD_NAMESPACE)/ingress-nginx-controller'
- '--election-id=ingress-controller-leader'
- '--ingress-class=nginx'
- '--configmap=$(POD_NAMESPACE)/ingress-nginx-controller'
- '--validating-webhook=:8443'
- '--validating-webhook-certificate=/usr/local/certificates/cert'
- '--validating-webhook-key=/usr/local/certificates/key'
- '--tcp-services-configmap=ingress-nginx/tcp-services'
What am I missing? How can I configure this w/o having to hand edit it? Thank you!
I think there are 2 issues.
You need to install nginx separately from your postgress installation. This means that you will have some nginx pods/deployments, and a service that exist in the ingress-nginx namespace. To do this, follow the guide here . It is recommended that you follow a yaml file from the cloud section for a docker desktop deployment. This is someone who has gone through the process.
Once nginx is installed on your cluster, you need to go from you postgress deployment/pod -> service -> ingress. These will be in a different namespace than your ingress-nginx one (default is fine). To configure it, you can follow the guide located here . If you want to test things along the way, you can use kube.netes port-forward
ing command to forward your postgress pod to your local machine. You can also test your service with the same method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.