Question

Get metrics from Kubernetes nodes

I would like to get advanced metrics from my Kubernetes worker node.

When I view the worker nodes in the Droplets screen, I get the usual instruction to shell into the Droplet and install the DO Agent, but I cannot shell into the worker.

Step 3 of the Kubernetes Quick Start guide says to choose a data center and an SSH key, but I do not have an SSH key option when I create a cluster so I appear to be unable to shell in to my worker node and install the DO Agent.

Is it possible to install the DO Agent on worker nodes?

Thanks!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

I’m use my own wrapper for it

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: do-agent
  namespace: monitoring
spec:
  selector:
    matchLabels:
      name: do-agent
      phase: prod
  template:
    metadata:
      labels:
        name: do-agent
        phase: prod
#      annotations:
#        prometheus.io/port: "10253"
#        prometheus.io/path: "/metrics"
#        prometheus.io/scrape: "true"
    spec:
      volumes:
      - name: proc
        hostPath:
          path: /proc
      containers:
      - name: do-agent
        image: trurlmcbyte/do-agent:0.5.1
#        command: ["/agent/do-agent_linux_amd64", "-log_level", "DEBUG"]
        ports:
        - containerPort: 10253
          hostPort: 10253
          protocol: TCP
          name: metrics
        volumeMounts:
        - name: proc
          readOnly: true
          mountPath: /agent/proc
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      hostNetwork: true
      hostPID: true
      schedulerName: default-scheduler
      tolerations:
      - operator: Exists
        effect: NoSchedule
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
  templateGeneration: 1
  revisionHistoryLimit: 10

wrapper itself is simple:

FROM golang:1.9-alpine

ENV CGO=0
ENV GOOS=linux

ARG CURRENT_BRANCH
ARG CURRENT_HASH
ARG LAST_RELEASE

RUN  apk update && \
     apk add bash && \
     apk add curl && \
     apk add git && \
     apk add make && \
     apk add libc6-compat

COPY ./do-agent /go/src/github.com/digitalocean/do-agent

RUN cd /go/src/github.com/digitalocean/do-agent && \
    set -x && \
    make build RELEASE=${LAST_RELEASE} CURRENT_BRANCH=${CURRENT_BRANCH} CURRENT_HASH=${CURRENT_HASH}

# Copy what is needed to
FROM alpine
ENV DO_AGENT_REPO_PATH   /agent/updates
ENV DO_AGENT_PROCFS_ROOT /agent/proc

RUN mkdir -p /agent
RUN mkdir -p /agent/updates
RUN mkdir -p /agent/proc

RUN  apk update && \
     apk add libc6-compat && \
     apk add ca-certificates

COPY --from=0 /go/src/github.com/digitalocean/do-agent/build/do-agent_linux_amd64 /agent
RUN find /agent

CMD /agent/do-agent_linux_amd64
Michelle Peot
DigitalOcean Employee
DigitalOcean Employee badge
February 13, 2019

Kubernetes monitoring is in progress, and should be out by next month. This will provide worker performance metrics in the DigitalOcean dashboard, as well as a handful of optional deployment-related kube-state-metrics. The do-agent will be installed by default.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel