This repository was archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Kubernetes Deployment #1110
Merged
Merged
Kubernetes Deployment #1110
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # K8s deployment for Elasticsearch, Kibana, and Fleet-Server | ||
|
|
||
| ## Requirements | ||
|
|
||
| - docker | ||
| - kind (>= 0.10.0) | ||
| - kubectl (>= 1.17) | ||
|
|
||
| ## Deployment | ||
|
|
||
| ``` | ||
| kind create cluster | ||
| kubectl apply -k base | ||
| ``` | ||
|
|
||
| This will allow you to visit `http://localhost:5601` using username: `elastic` password: `changeme` to login | ||
|
|
||
| ## Local Ingress (Optional) | ||
|
|
||
| If a local ingress is preferred, apply the following to setup nginx-ingress | ||
|
|
||
| ``` | ||
| kubectl apply -k overlays/local | ||
| ``` | ||
|
|
||
| This will allow you to reach the Kibana endpoint at `http://localhost` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: elasticsearch-config | ||
| data: | ||
| ES_JAVA_OPTS: "-Xms1g -Xmx1g" | ||
| network.host: "" | ||
| transport.host: "127.0.0.1" | ||
| http.host: "0.0.0.0" | ||
| indices.id_field_data.enabled: 'true' | ||
| xpack.license.self_generated.type: "trial" | ||
| xpack.security.enabled: 'true' | ||
| xpack.security.authc.api_key.enabled: 'true' | ||
| ELASTIC_USERNAME: "elastic" | ||
| ELASTIC_PASSWORD: "changeme" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: elasticsearch | ||
| labels: | ||
| app: elasticsearch | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: elasticsearch | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: elasticsearch | ||
| spec: | ||
| containers: | ||
| - name: elasticsearch | ||
| image: docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT | ||
| envFrom: | ||
| - configMapRef: | ||
| name: elasticsearch-config | ||
| ports: | ||
| - containerPort: 9200 | ||
| name: client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| resources: | ||
| - deployment.yaml | ||
| - service.yaml | ||
| - configmap.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: elasticsearch | ||
| labels: | ||
| service: elasticsearch | ||
| spec: | ||
| type: NodePort | ||
| ports: | ||
| - port: 9200 | ||
| name: client | ||
| selector: | ||
| app: elasticsearch |
12 changes: 12 additions & 0 deletions
12
cli/config/kubernetes/base/fleet-server/cluster-role-binding.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: fleet-server-cluster-role-binding | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: default | ||
| namespace: default | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: fleet-server-cluster-role | ||
| apiGroup: rbac.authorization.k8s.io |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: fleet-server-cluster-role | ||
| labels: | ||
| app: fleet-server | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: | ||
| - nodes | ||
| - namespaces | ||
| - events | ||
| - pods | ||
| - services | ||
| verbs: ["get", "list", "watch"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: fleet-server | ||
| labels: | ||
| app: fleet-server | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: fleet-server | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: fleet-server | ||
| spec: | ||
| containers: | ||
| - name: fleet-server | ||
| image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT | ||
| env: | ||
| - name: FLEET_SERVER_ENABLE | ||
| value: "1" | ||
| - name: FLEET_SERVER_INSECURE_HTTP | ||
| value: "1" | ||
| - name: KIBANA_FLEET_SETUP | ||
| value: "1" | ||
| - name: KIBANA_FLEET_HOST | ||
| value: "http://kibana:5601" | ||
| - name: FLEET_SERVER_HOST | ||
| value: "0.0.0.0" | ||
| - name: FLEET_SERVER_PORT | ||
| value: "8220" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| resources: | ||
| - deployment.yaml | ||
| - service.yaml | ||
| - role.yaml | ||
| - role-binding.yaml | ||
| - cluster-role.yaml | ||
| - cluster-role-binding.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: fleet-server-role-binding | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: fleet-server-role | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: default | ||
| namespace: default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: fleet-server-role | ||
| namespace: default | ||
| labels: | ||
| app: fleet-server | ||
| rules: | ||
| - apiGroups: | ||
| - coordination.k8s.io | ||
| resources: | ||
| - leases | ||
| verbs: ["get", "create", "update", "list", "watch", "update", "patch", "delete"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: fleet-server | ||
| labels: | ||
| service: fleet-server | ||
| spec: | ||
| type: NodePort | ||
| selector: | ||
| app: fleet-server | ||
| ports: | ||
| - port: 8220 | ||
| name: http |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: kibana | ||
| data: | ||
| kibana.yml: |- | ||
| --- | ||
| server.name: kibana | ||
| server.host: "0.0.0.0" | ||
|
|
||
| elasticsearch.hosts: [ "http://elasticsearch:9200" ] | ||
| elasticsearch.username: elastic | ||
| elasticsearch.password: changeme | ||
| monitoring.ui.container.elasticsearch.enabled: true | ||
|
|
||
| xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012" | ||
|
|
||
| xpack.fleet.enabled: true | ||
| xpack.fleet.registryUrl: http://package-registry:8080 | ||
| xpack.fleet.agents.enabled: true | ||
| xpack.fleet.agents.elasticsearch.host: http://elasticsearch:9200 | ||
| xpack.fleet.agents.fleet_server.hosts: ["http://fleet-server:8220"] | ||
| xpack.fleet.agents.kibana.host: "http://kibana:5601" | ||
| xpack.fleet.agents.tlsCheckDisabled: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: kibana | ||
| labels: | ||
| app: kibana | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: kibana | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: kibana | ||
| spec: | ||
| containers: | ||
| - name: kibana | ||
| image: docker.elastic.co/kibana/kibana:8.0.0-SNAPSHOT | ||
| env: | ||
| - name: ELASTICSEARCH_URL | ||
| value: http://elasticsearch:9200 | ||
| - name: ELASTICSEARCH_USERNAME | ||
| value: elastic | ||
| - name: ELASTICSEARCH_PASSWORD | ||
| value: changeme | ||
| ports: | ||
| - containerPort: 5601 | ||
| hostPort: 5601 | ||
| name: http | ||
| livenessProbe: | ||
| tcpSocket: | ||
| port: http | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 20 | ||
| readinessProbe: | ||
| tcpSocket: | ||
| port: http | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 20 | ||
| volumeMounts: | ||
| - mountPath: /usr/share/kibana/config/kibana.yml | ||
| name: config | ||
| subPath: kibana.yml | ||
| volumes: | ||
| - name: config | ||
| configMap: | ||
| name: kibana |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| resources: | ||
| - deployment.yaml | ||
| - service.yaml | ||
| - configmap.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: kibana | ||
| labels: | ||
| service: kibana | ||
| spec: | ||
| type: NodePort | ||
| ports: | ||
| - port: 5601 | ||
| name: http | ||
| selector: | ||
| app: kibana |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
| namespace: default | ||
| commonLabels: | ||
| env: test | ||
| bases: | ||
| - ./elasticsearch | ||
| - ./kibana | ||
| - ./package-registry | ||
| - ./fleet-server |
24 changes: 24 additions & 0 deletions
24
cli/config/kubernetes/base/package-registry/deployment.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: package-registry | ||
| labels: | ||
| app: package-registry | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: package-registry | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: package-registry | ||
| spec: | ||
| containers: | ||
| - name: package-registry | ||
| image: docker.elastic.co/package-registry/distribution:staging | ||
| livenessProbe: | ||
| tcpSocket: | ||
| port: 8080 | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 20 |
3 changes: 3 additions & 0 deletions
3
cli/config/kubernetes/base/package-registry/kustomization.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| resources: | ||
| - deployment.yaml | ||
| - service.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: package-registry | ||
| labels: | ||
| service: package-registry | ||
| spec: | ||
| type: NodePort | ||
| ports: | ||
| - port: 8080 | ||
| name: package-registry | ||
| selector: | ||
| app: package-registry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| kind: Cluster | ||
| apiVersion: kind.x-k8s.io/v1alpha4 | ||
| nodes: | ||
| - role: control-plane | ||
| kubeadmConfigPatches: | ||
| - | | ||
| kind: InitConfiguration | ||
| nodeRegistration: | ||
| kubeletExtraArgs: | ||
| node-labels: "ingress-ready=true" | ||
| extraPortMappings: | ||
| - containerPort: 80 | ||
| hostPort: 80 | ||
| protocol: TCP | ||
| - containerPort: 443 | ||
| hostPort: 443 | ||
| protocol: TCP | ||
| - containerPort: 5601 | ||
| hostPort: 5601 | ||
| protocol: TCP | ||
| - containerPort: 9200 | ||
| hostPort: 9200 | ||
| protocol: TCP | ||
| - containerPort: 8220 | ||
| hostPort: 8220 | ||
| protocol: TCP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apiVersion: networking.k8s.io/v1beta1 | ||
| kind: Ingress | ||
| metadata: | ||
| name: kibana-ingress | ||
| spec: | ||
| rules: | ||
| - http: | ||
| paths: | ||
| - path: / | ||
| backend: | ||
| serviceName: kibana | ||
| servicePort: 5601 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we exclude them from the linting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't figure out how to tell yaml-lint to allow multiple documents ina single file. Is there an option to set to allow that?