Skip to content

Commit c2aa74b

Browse files
author
Matt Raible
committed
Fix ingress definition and demo script
1 parent 5d61690 commit c2aa74b

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

jhipster-k8s/demo.adoc

+19-8
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ You can quit by typing `/exit`.
172172
./kubectl-apply.sh -f
173173
kubectl rollout restart deploy -n demo
174174

175-
. Verify everything still works at `\http://localhost:8080`.
175+
. Verify everything still works at `http://localhost:8080`.
176176

177177
TIP: If you don't want to restart the Spring Cloud Config server when you update its configuration, see link:/blog/2020/12/07/spring-cloud-config#refresh-the-configuration-in-your-spring-cloud-config-server[Refresh the Configuration in Your Spring Cloud Config Server].
178178

@@ -231,6 +231,9 @@ TIP: The cool kids use `kubectx` and `kubens` to set the default context and nam
231231

232232
. Open a https://console.cloud.google.com/[console] in your browser or download and install the https://cloud.google.com/sdk/[`gcloud` CLI] if you want to run things locally.
233233

234+
glcoud auth login
235+
gcloud config set project <project-id>
236+
234237
. Enable the Google Kubernetes Engine API and Container Registry:
235238

236239
gcloud services enable container.googleapis.com containerregistry.googleapis.com
@@ -261,11 +264,19 @@ containers:
261264
----
262265

263266
. In the `k8s` directory, apply all the deployment descriptors to run all your images.
264-
267+
+
265268
[source,shell]
266269
----
267270
./kubectl-apply.sh -f
268271
----
272+
+
273+
[TIP]
274+
====
275+
If you get an error that `localhost:8080 was refused`, run the following command:
276+
----
277+
gcloud container clusters get-credentials <cluster-name> --zone us-central1-a
278+
----
279+
====
269280

270281
=== Access Your Gateway on Google Cloud
271282

@@ -279,7 +290,7 @@ containers:
279290

280291
. Use the following command to set your gateway's IP address as a variable you can curl.
281292

282-
EXTERNAL_IP=$(kubectl get svc gateway -n demo -ojsonpath="{.status.loadBalancer.ingress[0].ip}")
293+
EXTERNAL_IP=$(kubectl get svc gateway -ojsonpath="{.status.loadBalancer.ingress[0].ip}" -n demo)
283294
curl $EXTERNAL_IP:8080
284295

285296
. Run `open \http://$EXTERNAL_IP:8080`, and you should be able to sign in.
@@ -313,7 +324,7 @@ spec:
313324
- http:
314325
paths:
315326
- path: /*
316-
pathType: Prefix
327+
pathType: ImplementationSpecific
317328
backend:
318329
service:
319330
name: gateway
@@ -338,7 +349,7 @@ kubectl get ingress gateway -n demo
338349
+
339350
[source,shell]
340351
----
341-
EXTERNAL_IP=$(kubectl get ingress gateway -ojsonpath="{.status.loadBalancer.ingress[0].ip}")
352+
EXTERNAL_IP=$(kubectl get ingress gateway -n demo -ojsonpath="{.status.loadBalancer.ingress[0].ip}")
342353
DOMAIN="${EXTERNAL_IP}.nip.io"
343354
344355
# Prove it works
@@ -379,7 +390,7 @@ metadata:
379390

380391
. Check your certificate's status until it prints `Status: ACTIVE`:
381392

382-
kubectl describe managedcertificate gateway-certificate -n demo
393+
kubectl describe managedcertificate gateway-certificate -n demo | grep Status
383394

384395
=== Force HTTPS with Spring Security
385396

@@ -403,11 +414,11 @@ http.redirectToHttps(redirect -> redirect
403414

404415
kubectl rollout restart deployment gateway -n demo
405416

406-
. Now you should get a 302 when you access your domain using https://httpie.io/[HTTPie]`.
417+
. Now you should get a 302 when you access your domain using https://httpie.io/[HTTPie].
407418

408419
http $DOMAIN
409420

410-
. Update your Okta OIDC app to have `\https://${DOMAIN}/login/oauth2/code/oidc` as a valid redirect URI. Add `\https://${DOMAIN}.nip.io` to the sign-out redirect URIs too.
421+
. Update your Okta OIDC app to have `\https://${DOMAIN}/login/oauth2/code/oidc` as a valid redirect URI. Add `\https://${DOMAIN}` to the sign-out redirect URIs too.
411422

412423
== Encrypt Kubernetes Secrets
413424

jhipster-k8s/k8s/ingress.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
- http:
1111
paths:
1212
- path: /*
13-
pathType: Prefix
13+
pathType: ImplementationSpecific
1414
backend:
1515
service:
1616
name: gateway

0 commit comments

Comments
 (0)