Skip to content

Commit

Permalink
Update Google Cloud LB recipe (#4371)
Browse files Browse the repository at this point in the history
* Update Google Cloud LB recipe

* Add note about cert-manager version
  • Loading branch information
charith-elastic authored Mar 30, 2021
1 parent 2c3d85b commit dc13c68
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 6 deletions.
3 changes: 2 additions & 1 deletion config/recipes/gclb/00-prereq-cluster-issuer.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
apiVersion: cert-manager.io/v1alpha2
# Requires cert-manager 1.0.0 or higher
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigning-issuer
Expand Down
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'
----

== 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[]
----

0 comments on commit dc13c68

Please sign in to comment.