Skip to content

Kubernetes Integration

PlatOps AI can be used to monitor and manage Kubernetes clusters.

Prerequisites:

  • Kubernetes cluster

If you don't have a Kubernetes cluster, you can create a playground cluster using the instruction in the k8s-agent repository.

Installing the agent

Follow the readme in the k8s-agent repository to install the agent in your cluster.

Configuring the agent

The agent requires specific RBAC permissions to monitor and manage your cluster.

Here are the key components needed:

  1. A ServiceAccount for the agent:
yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: k8s-agent
  namespace: default
  1. A ClusterRole with necessary permissions. Some important permission groups include:
yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: pod-replica-viewer
rules:
  # Core workload monitoring
  - apiGroups: ['apps', '']
    resources: ['deployments', 'replicasets', 'pods', 'services']
    verbs: ['get', 'list', 'watch']
  
  # Metrics and logging access
  - apiGroups: ['metrics.k8s.io']
    resources: ['pods', 'nodes']
    verbs: ['get', 'list', 'watch']
  
  # Configuration and security
  - apiGroups: ['']
    resources: ['configmaps', 'secrets']
    verbs: ['get', 'list', 'watch']
  1. A ClusterRoleBinding to connect the ServiceAccount with the ClusterRole:
yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: pod-replica-viewer-binding
subjects:
  - kind: ServiceAccount
    name: k8s-agent
    namespace: default
roleRef:
  kind: ClusterRole
  name: pod-replica-viewer
  apiGroup: rbac.authorization.k8s.io

You can find the complete RBAC configuration in the example RBAC YAML file.

For more details about Kubernetes RBAC, refer to the official Kubernetes RBAC documentation.

Post installation

After the agent is deployed on your cluster, we expose it through a load balancer service.

yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/coreweave-load-balancer-type: public
  name: k8s-agent
spec:
  type: LoadBalancer
  selector:
    app: k8s-agent
  ports:
    - port: 80
      targetPort: 3000

This is so PlatOps AI can access the agent.

WARNING

To secure the service from unauthorized access, you can whitelist only the IP addresses of the PlatOps AI servers.

Connecting the agent to your account

To complete the integration, you need to add the agent to your account.

Visit the Tools page and navigate to the Infrastructure section. Click on the connect button for the Kubernetes tool.

Enter the URL of the agent service and click on the save button.

INFO

The URL of the agent service is the URL of the load balancer service we created earlier.

Settings

Using the Kubernetes tool

Once connected, you can interact with your Kubernetes cluster through natural language commands in the chat interface.

Common Operations

The AI can help you with a wide range of Kubernetes operations:

Operation TypeDescription
🔍 MonitoringPod health and status checks
📝 Log AnalysisContainer log retrieval and analysis
⚖️ Scaling ManagementHPA configuration review and management
🚀 Deployment TrackingTrack and manage deployment progress
💻 Command ExecutionExecute container commands directly

And more!

Example Interactions

Below are examples of the AI helping with cluster management:

k8-chat-1k8-chat-2

INFO

Salt Key based authentication for the agent is coming soon.