text
stringlengths
0
59.1k
### Step 2: Create the DaemonSet definition.
The DaemonSet definition instructs Kubernetes to place a newrelic Infrastructure agent on each Kubernetes node.
<!-- BEGIN MUNGE: EXAMPLE newrelic-infra-daemonset.yaml -->
```yaml
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: newrelic-infra-agent
labels:
tier: monitoring
app: newrelic-infra-agent
version: v1
spec:
template:
metadata:
labels:
name: newrelic
spec:
# Filter to specific nodes:
# nodeSelector:
# app: newrelic
hostPID: true
hostIPC: true
hostNetwork: true
containers:
- resources:
requests:
cpu: 0.15
securityContext:
privileged: true
image: newrelic/infrastructure
name: newrelic
command: [ "bash", "-c", "source /etc/kube-nr-infra/config && /usr/bin/newrelic-infra" ]
volumeMounts:
- name: newrelic-config
mountPath: /etc/kube-nr-infra
readOnly: true
- name: dev
mountPath: /dev
- name: run
mountPath: /var/run/docker.sock
- name: log
mountPath: /var/log
- name: host-root
mountPath: /host
readOnly: true
volumes:
- name: newrelic-config
secret:
secretName: newrelic-config
- name: dev
hostPath:
path: /dev
- name: run
hostPath:
path: /var/run/docker.sock
- name: log
hostPath:
path: /var/log
- name: host-root
hostPath:
path: /
```
[Download example](newrelic-infra-daemonset.yaml?raw=true)
<!-- END MUNGE: EXAMPLE newrelic-infra-daemonset.yaml -->
The daemonset instructs Kubernetes to spawn pods on each node, mapping /dev/, /run/, and /var/log to the container. It also maps the entire kube node / to /host/ in the container with a read-only mount. It also maps the secrets we set up earlier to /etc/kube-newrelic/config, and sources them in the startup script, co...
#### DaemonSet customization
- There are more environment variables for fine tuning the infrastructure agent's operation (or a yaml file that you'd have to construct). See [Infrastructure Agent Environment Variables](https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/configuration/configure-infrastructure-agent) for the full l...
### Known issues
It's a bit cludgy to define the environment variables like we do here in these config files. There is [another issue](https://github.com/kubernetes/kubernetes/issues/4710) to discuss adding mapping secrets to environment variables in Kubernetes. (Personally I don't like that method and prefer to use the config secrets...
<|endoftext|>
# source: k8s_examples/_archived/sysdig-cloud/sysdig-daemonset.yaml type: yaml
#Use this sysdig.yaml when Daemon Sets are enabled on Kubernetes (minimum version 1.1.1). Otherwise use the RC method.
apiVersion: apps/v1 #for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
kind: DaemonSet
metadata:
name: sysdig-agent
labels:
app: sysdig-agent
spec:
selector:
matchLabels:
name: sysdig-agent
template:
metadata:
labels:
name: sysdig-agent
spec: