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:
- A ServiceAccount for the agent:
apiVersion: v1
kind: ServiceAccount
metadata:
name: k8s-agent
namespace: default
- A ClusterRole with necessary permissions. Some important permission groups include:
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']
- A ClusterRoleBinding to connect the ServiceAccount with the ClusterRole:
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.
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.
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 Type | Description |
---|---|
🔍 Monitoring | Pod health and status checks |
📝 Log Analysis | Container log retrieval and analysis |
⚖️ Scaling Management | HPA configuration review and management |
🚀 Deployment Tracking | Track and manage deployment progress |
💻 Command Execution | Execute container commands directly |
And more!
Example Interactions
Below are examples of the AI helping with cluster management:
INFO
Salt Key based authentication for the agent is coming soon.