Skip to content

Commit 5e88d4b

Browse files
author
Jeff McCormick
authored
Merge pull request #389 from StephenSorriaux/feat/access-pgo-apiserver-using-ingress
Add a new way to access postgres-operator apiserver using Kubernetes ingress
2 parents b5b569a + 521460f commit 5e88d4b

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

deploy/ingress.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: extensions/v1beta1
3+
kind: Ingress
4+
metadata:
5+
name: postgres-operator
6+
namespace: demo
7+
annotations:
8+
ingress.kubernetes.io/ssl-passthrough: "true"
9+
nginx.ingress.kubernetes.io/secure-backends: "true"
10+
spec:
11+
backend:
12+
serviceName: postgres-operator
13+
servicePort: 8443

hugo/content/installation/deployment.adoc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ This alias (`setip`) will set the `CO_APISERVER_URL` IP address for you.
116116

117117
==== Running Kubernetes Remotely
118118

119+
===== Port forwarding
120+
119121
Set up a port-forward tunnel from your host to the Kube remote host, specifying the operator pod -
120122
....
121123
kubectl get pod --selector=name=postgres-operator
@@ -131,6 +133,41 @@ export CO_APISERVER_URL=https://127.0.0.1:8443
131133
pgo version
132134
....
133135

136+
===== Using an ingress
137+
138+
Ingresses allows you to access Kubernetes services throught a controller.
139+
140+
First you will need to ensure a NGINX Ingress Controller is available in your Kubernetes cluster.
141+
142+
If you are using Minikube, you can easily deploy one using
143+
....
144+
minikube addons enable ingress
145+
....
146+
If not, please refer to the https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal[Nginx Ingress Controller's official documentation] for its installation.
147+
148+
Once your controller is running, just deploy the ingress using
149+
....
150+
kubectl create -f $COROOT/deploy/ingress.yml
151+
....
152+
Due to the annotations used, please note this ingress is currently usable only with Nginx Ingress Controller.
153+
154+
Now you can use the adress IP of the host where the nginx-ingress-controller pod is to connect to the pgo apiserver. The port will be 443 (and not 8443).
155+
156+
To retrieve the address ip:
157+
....
158+
kubectl get ingress postgres-operator -o jsonpath="{.status.loadBalancer.ingress[0].ip}"
159+
160+
export CO_APISERVER_URL=https://`kubectl get ingress postgres-operator -o jsonpath="{.status.loadBalancer.ingress[0].ip}"`
161+
....
162+
163+
If you are using minikube, the address IP displayed is incorrect, just use:
164+
....
165+
minikube ip
166+
167+
export CO_APISERVER_URL=https://`minikube ip`
168+
....
169+
170+
134171
{{% /expand%}}
135172

136173
== Verify pgo Client

0 commit comments

Comments
 (0)