[Infrastructure as Code (IaC) Pulumi] Use Pulumi kubernetes (K8S) Helm Chart to deploy Elastic Kibana
Elastic Kibana
Elastic Kibana is a free and open user interface that lets you visualize your Elasticsearch data and navigate the Elastic Stack. Do anything from tracking query load to understanding the way requests flow through your apps.
This article is about how to use Pulumi, kubernetes (K8S) provider, Helm Chart and TypeScript SDK to deploy Elastic Kibana within Kubernetes (K8S).
Prerequisites
-
Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
See Getting started | Kubernetes - https://kubernetes.io/docs/setup/ to leanr more.
-
Pulumi - Modern Infrastructure as Code - https://www.pulumi.com/
Pulumi is a modern infrastructure-as-code platform that allows you to use common programming languages, tools, and frameworks, to provision, update, and manage cloud infrastructure resources.
Install the Pulumi - https://www.pulumi.com/ CLI.
1
2Mac OS X
brew install pulumiSee Download and Install | Pulumi - https://www.pulumi.com/docs/get-started/install/ to learn more about others OS.
-
Node.js - https://nodejs.org/en/
Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine.
Install Node.js - https://nodejs.org/en/ CLI.
1
2Mac OS X
brew install nodeSee Node.js - https://nodejs.org/en/ to learn more about others OS.
-
Elasticsearch - https://www.elastic.co/elasticsearch/
Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease.
Usage
Pulumi New
Create the workspace directory.
1 | mkdir -p col-example-pulumi-typescript-kibana |
Pulumi login into local file system.
1 | pulumi login file://. |
Pulumi new a project with kubernetes-typescript SDK.
1 | pulumi new kubernetes-typescript |
The above command will create some files within the current directory.
1 | tree . -L 1 |
Install js-yaml
package to load and parse yaml file.
1 | npm i js-yaml |
Pulumi Configuration
Configure Kubernetes
By default, Pulumi will look for a kubeconfig file in the following locations, just like kubectl:
-
The environment variable:
$KUBECONFIG
, -
Or in current user’s default kubeconfig directory:
~/.kube/config
If the kubeconfig file is not in either of these locations, Pulumi will not find it, and it will fail to authenticate against the cluster. Set one of these locations to a valid kubeconfig file, if you have not done so already.
Generate a Admin and password Auth.
1 | htpasswd -c ./ing-auth admin |
Remember the base64 output as the next Secret data.
manifests
Edit manifests/Secret.yaml and replace content within {{ }}
.
1 | # manifests/Secret.yaml |
Configure Values.yaml
Edit values.yaml and replace content within {{ }}
.
1 | # values.yaml |
main.ts
1 | // main.ts |
Pulumi Up
Run pulumi up to create the namespace and pods.
1 | pulumi up |
See pods about kibana.
1 | kubectl get pods -n elastic |
Pulumi Destroy
Destroy all resources created by Pulumi.
1 | pulumi destroy |
FAQs
no matches for kind “Ingress” in version “networking.k8s.io/v1beta1” since Kubernets (K8S) v1.22
1 | Verify that any required CRDs have been created: no matches for kind "Ingress" in version "networking.k8s.io/v1beta1" |
The extensions/v1beta1
and networking.k8s.io/v1beta1
API versions of Ingress is no longer served as of v1.22.
-
Migrate manifests and API clients to use the
networking.k8s.io/v1
API version, available since v1.19. -
All existing persisted objects are accessible via the new API
Notable changes:
- spec.backend is renamed to spec.defaultBackend - The backend serviceName field is renamed to service.name - Numeric backend servicePort fields are renamed to service.port.number - String backend servicePort fields are renamed to service.port.name - pathType is now required for each specified path. Options are Prefix, Exact, and ImplementationSpecific. To match the undefined v1beta1 behavior, use ImplementationSpecific.
See Deprecated API Migration Guide | Kubernetes - https://kubernetes.io/docs/reference/using-api/deprecation-guide/ to learn more.
First, create Ingress.yaml
with new Ingress with networking.k8s.io/v1
API version.
1 | # manifests/Ingress.yaml |
See Ingress | Kubernetes - https://kubernetes.io/docs/concepts/services-networking/ingress/ to leanr more.
Then, run kubectl apply
command.
1 | kubectl apply -f Ingress.yaml |
Now, you can visite Grafana Loki with https://{{ .Values.host }}
.
no matches for kind “Ingress” in version “extensions/v1beta1” since Kubernetes (K8S) v1.22
1 | Verify that any required CRDs have been created: no matches for kind "Ingress" in version "extensions/v1beta1" |
Same as above no matches for kind "Ingress" in version "networking.k8s.io/v1beta1" since Kubernets (K8S) v1.22
.
References
[1] elastic/kibana: Your window into the Elastic Stack - https://github.com/elastic/kibana
[3] Kibana: Explore, Visualize, Discover Data | Elastic - https://www.elastic.co/kibana/
[6] Kubernetes Getting Started | Pulumi - https://www.pulumi.com/docs/get-started/kubernetes/
[7] Pulumi - Modern Infrastructure as Code - https://www.pulumi.com/
[8] Kubernetes - https://kubernetes.io/
[9] TypeScript: Typed JavaScript at Any Scale. - https://www.typescriptlang.org/