Skip to content

Instantly share code, notes, and snippets.

@Dudesons
Created December 17, 2019 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dudesons/e7107413785972391d7d034b6b155c2a to your computer and use it in GitHub Desktop.
Save Dudesons/e7107413785972391d7d034b6b155c2a to your computer and use it in GitHub Desktop.
apiVersion: elasticsearch.k8s.elastic.co/v1beta1
kind: Elasticsearch
metadata:
annotations:
common.k8s.elastic.co/controller-version: 1.0.0-beta1
elasticsearch.k8s.elastic.co/cluster-uuid: f6y61iJISzyIaZtMSXqFHA
creationTimestamp: "2019-12-06T10:21:31Z"
finalizers:
- finalizer.elasticsearch.k8s.elastic.co/observer
- finalizer.elasticsearch.k8s.elastic.co/secure-settings-secret
- finalizer.elasticsearch.k8s.elastic.co/http-certificates-secret
generation: 6
name: datawarehouse
namespace: default
resourceVersion: "24006887"
selfLink: /apis/elasticsearch.k8s.elastic.co/v1beta1/namespaces/default/elasticsearches/datawarehouse
uid: 2c1c29fc-1812-11ea-a8fa-4201c0a8000b
spec:
http:
service:
metadata:
creationTimestamp: null
spec: {}
tls:
certificate: {}
selfSignedCertificate:
disabled: true
image: gcr.io/hivebrite/elasticsearch7:7cabc9a
nodeSets:
- config:
cluster.routing.allocation.awareness.attributes: zone
node.attr.zone: europe-west1-a
node.data: false
node.master: true
count: 1
name: master-europe-west1-a
podTemplate:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- europe-west1-a
- matchExpressions:
- key: workloadType
operator: In
values:
- elasticsearch
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: datawarehouse
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms7782m -Xmx7782m
limits:
cpu: 4000m
memory: 8Gi
name: elasticsearch
readinessProbe:
exec:
command:
- bash
- -c
- /mnt/elastic-internal/scripts/readiness-probe-script.sh
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
resources:
requests:
cpu: 4000m
memory: 8Gi
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1000
initContainers:
- command:
- sh
- -c
- sysctl -w vm.max_map_count=262144
name: sysctl
securityContext:
privileged: true
metadata:
labels:
clusterName: wip
region: europe-west1
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
- config:
cluster.routing.allocation.awareness.attributes: zone
node.attr.zone: europe-west1-b
node.data: false
node.master: true
count: 1
name: master-europe-west1-b
podTemplate:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- europe-west1-b
- matchExpressions:
- key: workloadType
operator: In
values:
- elasticsearch
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: datawarehouse
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms7782m -Xmx7782m
limits:
cpu: 4000m
memory: 8Gi
name: elasticsearch
readinessProbe:
exec:
command:
- bash
- -c
- /mnt/elastic-internal/scripts/readiness-probe-script.sh
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
resources:
requests:
cpu: 4000m
memory: 8Gi
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1000
initContainers:
- command:
- sh
- -c
- sysctl -w vm.max_map_count=262144
name: sysctl
securityContext:
privileged: true
metadata:
labels:
clusterName: wip
region: europe-west1
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
- config:
cluster.routing.allocation.awareness.attributes: zone
node.attr.zone: europe-west1-c
node.data: false
node.master: true
count: 1
name: master-europe-west1-c
podTemplate:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- europe-west1-c
- matchExpressions:
- key: workloadType
operator: In
values:
- elasticsearch
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: datawarehouse
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms7782m -Xmx7782m
limits:
cpu: 4000m
memory: 8Gi
name: elasticsearch
readinessProbe:
exec:
command:
- bash
- -c
- /mnt/elastic-internal/scripts/readiness-probe-script.sh
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
resources:
requests:
cpu: 4000m
memory: 8Gi
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1000
initContainers:
- command:
- sh
- -c
- sysctl -w vm.max_map_count=262144
name: sysctl
securityContext:
privileged: true
metadata:
labels:
clusterName: wip
region: europe-west1
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
- config:
cluster.routing.allocation.awareness.attributes: zone
node.attr.zone: europe-west1-a
node.data: true
node.master: false
count: 1
name: data-europe-west1-a
podTemplate:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- europe-west1-a
- matchExpressions:
- key: workloadType
operator: In
values:
- elasticsearch
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: datawarehouse
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms7782m -Xmx7782m
limits:
cpu: 4000m
memory: 8Gi
name: elasticsearch
readinessProbe:
exec:
command:
- bash
- -c
- /mnt/elastic-internal/scripts/readiness-probe-script.sh
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
resources:
requests:
cpu: 4000m
memory: 8Gi
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1000
initContainers:
- command:
- sh
- -c
- sysctl -w vm.max_map_count=262144
name: sysctl
securityContext:
privileged: true
metadata:
labels:
clusterName: wip
region: europe-west1
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
- config:
cluster.routing.allocation.awareness.attributes: zone
node.attr.zone: europe-west1-b
node.data: true
node.master: false
count: 1
name: data-europe-west1-b
podTemplate:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- europe-west1-b
- matchExpressions:
- key: workloadType
operator: In
values:
- elasticsearch
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: datawarehouse
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms7782m -Xmx7782m
limits:
cpu: 4000m
memory: 8Gi
name: elasticsearch
readinessProbe:
exec:
command:
- bash
- -c
- /mnt/elastic-internal/scripts/readiness-probe-script.sh
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
resources:
requests:
cpu: 4000m
memory: 8Gi
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1000
initContainers:
- command:
- sh
- -c
- sysctl -w vm.max_map_count=262144
name: sysctl
securityContext:
privileged: true
metadata:
labels:
clusterName: wip
region: europe-west1
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
- config:
cluster.routing.allocation.awareness.attributes: zone
node.attr.zone: europe-west1-c
node.data: true
node.master: false
count: 1
name: data-europe-west1-c
podTemplate:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- europe-west1-c
- matchExpressions:
- key: workloadType
operator: In
values:
- elasticsearch
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: datawarehouse
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms7782m -Xmx7782m
limits:
cpu: 4000m
memory: 8Gi
name: elasticsearch
readinessProbe:
exec:
command:
- bash
- -c
- /mnt/elastic-internal/scripts/readiness-probe-script.sh
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
resources:
requests:
cpu: 4000m
memory: 8Gi
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1000
initContainers:
- command:
- sh
- -c
- sysctl -w vm.max_map_count=262144
name: sysctl
securityContext:
privileged: true
metadata:
labels:
clusterName: wip
region: europe-west1
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
updateStrategy:
changeBudget:
maxSurge: 1
maxUnavailable: 1
version: 7.5.0
status:
availableNodes: 6
health: green
phase: Ready
apiVersion: v1
data:
s3.client.default.access_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
s3.client.default.secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
kind: Secret
metadata:
creationTimestamp: "2019-12-11T15:53:10Z"
name: datawarehouse-aws-credentials
namespace: default
resourceVersion: "23145375"
selfLink: /api/v1/namespaces/default/secrets/datawarehouse-aws-credentials
uid: 54cac345-1c2e-11ea-9b78-4201c0a8000a
type: kubernetes.io/generic
apiVersion: v1
data:
script.sh: |-
function exit_if_fail {
if [ "$1" -ne 0 ]; then
if [ -n "$2" ]
then
rm -rf "$2"
fi
exit 1
fi
}
curl -XPUT -H "Content-Type: application/json" -o "/dev/null" -s -XPUT -w '%{http_code}' "http://elastic:$ES_CREDS@datawarehouse-es-http.default.svc.cluster.local:9200/_snapshot/s3_repository" -d "
{
\"type\": \"s3\",
\"settings\": {
\"bucket\": \"$BUCKET\",
\"region\": \"$REGION\",
\"compress\": \"true\"
}
}" | grep '2\d\d'
exit_if_fail $?
curl -XPUT -H "Content-Type: application/json" -o "/dev/null" -s -XPUT -w '%{http_code}' "http://elastic:$ES_CREDS@datawarehouse-es-http.default.svc.cluster.local:9200/_slm/policy/hourly-snapshots" -d '
{
"schedule": "0 0 * * * ?",
"name": "<hourly-snap-{now/d{yyyy.MM.dd.HH}}>",
"repository": "s3_repository",
"config": {
"indices": ["*"]
},
"retention": {
"expire_after": "30d",
"min_count": 240,
"max_count": 750
}
}' | grep '2\d\d'
exit_if_fail $?
kind: ConfigMap
metadata:
creationTimestamp: "2019-12-11T17:10:44Z"
name: datawarehouse-es-snapshot-setup
namespace: default
resourceVersion: "24019184"
selfLink: /api/v1/namespaces/default/configmaps/datawarehouse-es-snapshot-setup
uid: 2ad57a99-1c39-11ea-a8fa-4201c0a8000b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment