Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Google Cloud LB recipe #4371

Merged
merged 2 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions config/recipes/gclb/02-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hulk
Expand All @@ -21,13 +21,19 @@ spec:
http:
paths:
- path: "/*"
pathType: Exact
backend:
serviceName: hulk-es-http
servicePort: 9200
service:
name: hulk-es-http
port:
name: https
- host: "kibana.hulk"
http:
paths:
- path: "/*"
pathType: Exact
backend:
serviceName: hulk-kb-http
servicePort: 5601
service:
name: hulk-kb-http
port:
name: https
68 changes: 68 additions & 0 deletions config/recipes/gclb/99-kibana-path.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# How to serve Kibana from a path. In this example we make Kibana available at https://elastic.stack/kibana.
---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: thor
labels:
app: thor
spec:
version: 7.11.2
count: 1
config:
# Make Kibana aware of the fact that it is behind a proxy
server:
basePath: "/kibana"
rewriteBasePath: true
publicBaseUrl: "https://elastic.stack/kibana"
http:
service:
metadata:
labels:
app: thor
annotations:
# Enable TLS between GCLB and the application
cloud.google.com/app-protocols: '{"https":"HTTPS"}'
service.alpha.kubernetes.io/app-protocols: '{"https":"HTTPS"}'
# Comment out the following line if you are not using a VPC-native cluster
cloud.google.com/neg: '{"ingress": true}'
elasticsearchRef:
name: hulk
podTemplate:
spec:
containers:
- name: kibana
readinessProbe:
# Override the readiness probe as GCLB reuses it for its own healthchecks
# The path must contain the path prefix used to serve the application from the load balancer
httpGet:
scheme: HTTPS
path: "/kibana/login"
port: 5601
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: thor
labels:
app: thor
annotations:
# Issue certificates for TLS hosts automatically
cert-manager.io/cluster-issuer: "selfsigning-issuer"
# Disable HTTP traffic
kubernetes.io/ingress.allow-http: "false"
spec:
tls:
- hosts: ["elastic.stack"]
secretName: elastic-stack-cert
rules:
- host: "elastic.stack"
http:
paths:
- path: "/kibana/*"
pathType: Exact
backend:
service:
name: thor-kb-http
port:
name: https
9 changes: 9 additions & 0 deletions config/recipes/gclb/README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ Access Elasticsearch.
----
curl -H "Host: elasticsearch.hulk" --resolve "elasticsearch.hulk:443:$INGRESS_HOST" -k -u "elastic:$ELASTICSEARCH_PASSWORD" 'https://elasticsearch.hulk/_cat/health?v'
----

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not added in this PR but should we add a not about the minimal version of cert-manager you are expecting (I had an old one installed and need to upgrade first before this recipe worked ootb)

== Bonus: Serve Kibana from a path

In the above example, Kibana is accessed through a dedicated domain (`https://kibana.hulk`). If you want to make Kibana accessible from a path of an existing domain (e.g. `https://elastic.stack/kibana`) extra configuration is required.

[source,yaml]
----
include::99-kibana-path.yaml[]
----