add extraContainers options to valkey deployment and statefulset#115
Open
OctoCrisp wants to merge 4 commits intovalkey-io:mainfrom
Open
add extraContainers options to valkey deployment and statefulset#115OctoCrisp wants to merge 4 commits intovalkey-io:mainfrom
OctoCrisp wants to merge 4 commits intovalkey-io:mainfrom
Conversation
Signed-off-by: OctoCrisp <cpaulipost@gmail.com>
Signed-off-by: OctoCrisp <cpaulipost@gmail.com>
Signed-off-by: OctoCrisp <cpaulipost@gmail.com>
Signed-off-by: OctoCrisp <cpaulipost@gmail.com>
Collaborator
|
@OctoCrisp Thanks for the PR, it looks good. Did you test that it works? Can you share an example? |
Author
|
Sure. extraContainers:
- name: elastic-agent
image: registry.hub.docker.com/elastic/elastic-agent:9.2.4
env:
# Set to 1 for enrollment into Fleet server. If not set, Elastic Agent is run in standalone mode
- name: FLEET_ENROLL
value: "1"
# Set to true to communicate with Fleet with either insecure HTTP or unverified HTTPS
- name: FLEET_INSECURE
value: "false"
# Fleet Server URL to enroll the Elastic Agent into
# FLEET_URL can be found in Kibana, go to Management > Fleet > Settings
- name: FLEET_URL
value: "https://my.elastic-instance.fake:443"
# Elasticsearch API key used to enroll Elastic Agents in Fleet (https://www.elastic.co/guide/en/fleet/current/fleet-enrollment-tokens.html#fleet-enrollment-tokens)
# If FLEET_ENROLLMENT_TOKEN is empty then KIBANA_HOST, KIBANA_FLEET_USERNAME, KIBANA_FLEET_PASSWORD are needed
- name: FLEET_ENROLLMENT_TOKEN
value: "...psst...this_is_a_secret_token..."
- name: KIBANA_HOST
value: "http://kibana:5601"
# The basic authentication username used to connect to Kibana and retrieve a service_token to enable Fleet
- name: KIBANA_FLEET_USERNAME
value: "your_fleet_user"
# The basic authentication password used to connect to Kibana and retrieve a service_token to enable Fleet
- name: KIBANA_FLEET_PASSWORD
value: "your_kibana_fleet_user_password"
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
# The following ELASTIC_NETINFO:false variable will disable the netinfo.enabled option of add-host-metadata processor. This will remove fields host.ip and host.mac.
# For more info: https://www.elastic.co/guide/en/beats/metricbeat/current/add-host-metadata.html
- name: ELASTIC_NETINFO
value: "false"
securityContext:
runAsUser: 0
# The following capabilities are needed for Universal Profiling.
# More fine graded capabilities are only available for newer Linux kernels.
# If you are using the Universal Profiling integration, please uncomment these lines before applying.
#procMount: "Unmasked"
#privileged: true
#capabilities:
# add:
# - SYS_ADMIN
resources:
limits:
memory: 1Gi
requests:
cpu: 100m
memory: 500Mihelm template . -f ./pathto/clusteroverlay.yaml you should get: # Source: valkey/templates/deploy_valkey.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: mydeployment-valkey
labels:
helm.sh/chart: valkey-0.9.2
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: mydeployment
app.kubernetes.io/version: "9.0.1"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
strategy:
type: RollingUpdate
selector:
matchLabels:
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: mydeployment
template:
metadata:
labels:
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: mydeployment
annotations:
checksum/initconfig: a7b1fb480fbe8cc98a54cc265b4047ff
spec:
automountServiceAccountToken: false
serviceAccountName: mydeployment-valkey
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsUser: 1000
initContainers:
- name: mydeployment-valkey-init
image: docker.io/valkey/valkey:9.0.1
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
command: [ "/scripts/init.sh" ]
volumeMounts:
- name: valkey-data
mountPath: /data
- name: scripts
mountPath: /scripts
containers:
- name: mydeployment-valkey
image: docker.io/valkey/valkey:9.0.1
imagePullPolicy: IfNotPresent
command: [ "valkey-server" ]
args: [ "/data/conf/valkey.conf" ]
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
env:
- name: VALKEY_LOGLEVEL
value: "notice"
ports:
- name: tcp
containerPort: 6379
protocol: TCP
startupProbe:
exec:
command: [ "sh", "-c", "valkey-cli ping" ]
livenessProbe:
exec:
command: [ "sh", "-c", "valkey-cli ping" ]
resources:
{}
volumeMounts:
- name: valkey-data
mountPath: /data
- env:
- name: FLEET_ENROLL
value: "1"
- name: FLEET_INSECURE
value: "false"
- name: FLEET_URL
value: https://my.elastic-instance.fake:443
- name: FLEET_ENROLLMENT_TOKEN
value: '...psst...this_is_a_secret_token...'
- name: KIBANA_HOST
value: http://kibana:5601
- name: KIBANA_FLEET_USERNAME
value: your_fleet_user
- name: KIBANA_FLEET_PASSWORD
value: your_kibana_fleet_user_password
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: ELASTIC_NETINFO
value: "false"
image: registry.hub.docker.com/elastic/elastic-agent:9.2.4
name: elastic-agent
resources:
limits:
memory: 1Gi
requests:
cpu: 100m
memory: 500Mi
securityContext:
runAsUser: 0
volumes:
- name: scripts
configMap:
name: mydeployment-valkey-init-scripts
defaultMode: 0555
- name: valkey-data
emptyDir: {} |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I would need to collect metrics via elastic-agent and add it to the pod here if possable.
Tested templating no negative impact