Created
September 17, 2018 21:18
-
-
Save richardsonlima/33e8d0c7060b924a7a3f431f21ef9d15 to your computer and use it in GitHub Desktop.
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
1. Creating an EBS volume on AWS using cli | |
aws ec2 --profile ti create-volume --size 80 --region us-east-1 --availability-zone us-east-1a |
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
kind: PersistentVolume | |
apiVersion: v1 | |
metadata: | |
namespace: reportportal | |
name: elasticsearch | |
spec: | |
capacity: | |
storage: 80Gi | |
accessModes: | |
- ReadWriteOnce | |
awsElasticBlockStore: | |
volumeID: vol-07846eae9ec0fa9db | |
fsType: ext4 |
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
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
namespace: reportportal | |
name: elasticsearch | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 80Gi |
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
apiVersion: v1 | |
kind: Service | |
metadata: | |
namespace: reportportal | |
name: elasticsearch | |
labels: | |
spec: | |
clusterIP: None | |
ports: | |
- name: headless | |
port: 9200 | |
protocol: TCP | |
targetPort: 9200 | |
selector: | |
component: elasticsearch | |
type: ClusterIP | |
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
apiVersion: apps/v1beta2 | |
kind: StatefulSet | |
metadata: | |
namespace: reportportal | |
name: elasticsearch | |
labels: | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
component: elasticsearch | |
serviceName: elasticsearch | |
template: | |
metadata: | |
labels: | |
component: elasticsearch | |
spec: | |
terminationGracePeriodSeconds: 300 | |
initContainers: | |
# NOTE: | |
# This is to fix the permission on the volume | |
# By default elasticsearch container is not run as | |
# non root user. | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_notes_for_production_use_and_defaults | |
- name: fix-the-volume-permission | |
image: busybox | |
command: | |
- sh | |
- -c | |
- chown -R 1000:1000 /usr/share/elasticsearch/data | |
securityContext: | |
privileged: true | |
volumeMounts: | |
- name: elasticsearch | |
mountPath: /usr/share/elasticsearch/data | |
# NOTE: | |
# To increase the default vm.max_map_count to 262144 | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode | |
- name: increase-the-vm-max-map-count | |
image: busybox | |
command: | |
- sysctl | |
- -w | |
- vm.max_map_count=262144 | |
securityContext: | |
privileged: true | |
# To increase the ulimit | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_notes_for_production_use_and_defaults | |
- name: increase-the-ulimit | |
image: busybox | |
command: | |
- sh | |
- -c | |
- ulimit -n 65536 | |
securityContext: | |
privileged: true | |
containers: | |
- image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.1.1 | |
#ports: | |
#- containerPort: 9200 | |
# name: http | |
#- containerPort: 9300 | |
# name: tcp | |
name: elasticsearch | |
volumeMounts: | |
- mountPath: /usr/share/elasticsearch/data | |
name: elasticsearch | |
volumes: | |
- name: elasticsearch | |
persistentVolumeClaim: | |
claimName: elasticsearch | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment