OPS agent installation in docker

Hello,

I wanted to know how to install and start the agent ops service in a docker container.
Do you have any suggestion please ?

Please find my Dockerfile : 

# Use an official Ubuntu runtime as a parent image
FROM ubuntu:latest

# Install necessary dependencies
RUN apt-get update && \
apt-get install -y curl

# Download and install the Ops Agent
bash add-google-cloud-ops-agent-repo.sh --also-install

# Cleanup
RUN rm add-google-cloud-ops-agent-repo.sh && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

I will need  to use after on Kubernete with an deployment.yaml file.
Thank you
0 2 471
2 REPLIES 2

Hi @Navirash,

Welcome to the Google Cloud Community!

After building your image and uploading it to a repository, you can deploy the Ops Agent as a DaemonSet using the manifest file below.

opsagentds.yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: ops-agent-ds
spec:
  selector:
    matchLabels:
      name: ops-agent
  template:
    metadata:
      labels:
        name: ops-agent
    spec:
      containers:
      - name: ops-agent
        image: your-registry/your-image:your-tag  #Replace with image path
 

I hope this helps. Please let me know if you need further assistance or encounter any errors. 

Best,
Lawrence

Thanks for your help @lawrencenelson