Deploying Kubernetes Agents - Complete Guide | Nife Deploy
Agents are services deployed on your cluster that enable monitoring, logging, and enhanced Nife platform features.
What are Agents?#
Agents are lightweight services that run on your Kubernetes cluster and:
- Monitor cluster health and metrics
- Collect and stream pod logs
- Run security scans
- Report resource usage
- Enable AI-powered log analysis
- Maintain real-time communication with Nife
Before Deploying#
Prerequisites:
- Cluster is connected to Nife
- You have cluster admin access
- Enough resources on cluster:
- 100MB memory
- 10m CPU
- 1GB storage
Deploying Your First Agent#
Step 1: Start Agent Deployment#
- Go to Clusters page
- Click Add Agent button (top right)
- Or select cluster and click Add Agent
Step 2: Select Cluster#
Cluster Selection:
- Choose the cluster where agent will run
- Cluster name is pre-filled if coming from cluster detail
- Can only deploy one agent per cluster initially
Step 3: Choose Capabilities#
Select what the agent can do:
Available Capabilities:
| Capability | Purpose | Recommended |
|---|---|---|
| Monitoring | Collect metrics (CPU, memory, disk) | Always โ |
| Logging | Stream pod logs | Yes โ |
| Security | Run security scans | Yes โ |
| Analytics | Enable AI analysis | Yes โ |
| Auto-scaling | Allow auto-scaling | Optional |
| Deployment | Deploy applications | Yes โ |
Selecting Capabilities:
- Check boxes next to desired capabilities
- At minimum, enable Monitoring
- Most users want Monitoring, Logging, Security
Step 4: Generate Agent Token#
- Click Generate Token
- Token is created securely
- Token appears in the dialog
Important: Save this token securely. You'll need it to authenticate the agent.
Step 5: Deploy Agent#
Two methods to deploy:
Method 1: Automatic Deployment
Method 2: Manual Kubeconfig
Step 6: Verify Deployment#
- After deployment, wait 1-2 minutes
- Go to Agents tab
- Find your agent in the list
- Status should show Connected or Healthy
Managing Agents#
View Agent Details#
- Go to Agents tab
- Click Details on any agent
- See:
- Agent status
- Connected cluster
- Deployed capabilities
- Recent metrics
- Last heartbeat
Agent Status Meanings#
| Status | Meaning | Action |
|---|---|---|
| Connected | Agent is running and communicating | Ready to use |
| Healthy | Agent is functioning normally | No action needed |
| Disconnected | Agent lost connection | Investigate network |
| Error | Agent encountered an error | Check logs |
Monitor Agent Metrics#
Each agent shows:
- CPU Usage: Percentage of CPU being used
- Memory Usage: RAM consumption
- Disk Usage: Storage space used
- Last Heartbeat: When agent last reported
Rotate Agent Token#
Refresh agent's authentication token:
- Click Details on agent
- Click menu (three dots)
- Select Rotate Token
- Confirm rotation
- Agent continues running with new token
Why rotate tokens:
- Periodic security refresh
- If token is compromised
- After security audit
- Regular maintenance
Trigger Security Scan#
Run security checks on cluster:
- Go to Agents tab
- Click menu (three dots) on agent
- Select Trigger Security Scan
- Scan starts immediately
- Results appear in Security Findings
Agent Deployment Troubleshooting#
Issue: Agent Won't Connect#
Symptoms:
- Agent status shows "Disconnected"
- Metrics not appearing
- Last heartbeat is old
Solutions:
- Check cluster connectivity
- Verify agent pod is running:
- Check agent logs:
- Verify firewall allows outbound HTTPS
- Check if token has expired
Issue: Deployment Failed#
Symptoms:
- Agent pod never starts
- Status shows "Error"
Solutions:
- Verify cluster has enough resources
- Check kubeconfig is correct
- Verify cluster admin access
- Check namespace exists
- Try re-deploying with new token
Issue: High Resource Usage#
Symptoms:
- Agent using more CPU/memory than expected
- Cluster performance affected
Solutions:
- Check agent version is current
- Review security scan frequency
- Limit log streaming tail lines
- Disable unnecessary capabilities
- Contact support for optimization
Issue: Token Expired#
Symptoms:
- Agent stops connecting after time period
- Authentication errors in logs
Solutions:
- Generate new token
- Update agent with new token
- Or rotate token (easier)
- Redeploy agent if needed
Agent Capabilities Explained#
Monitoring#
Collects real-time metrics about cluster and nodes:
- CPU, memory, disk usage
- Network I/O
- Pod counts
- Node status
Use when: Always enable for all clusters
Logging#
Enables pod log collection and streaming:
- Fetch historical logs
- Stream logs in real-time
- Filter and search logs
- Export logs
Use when: You need to view application logs
Security#
Runs security scans on cluster:
- Vulnerability scanning
- Configuration audit
- Access control review
- Compliance checking
Use when: Security is important (always recommended)
Analytics#
Enables AI-powered log analysis:
- Automatically detect issues
- Identify patterns
- Suggest fixes
- Analyze trends
Use when: Want intelligent insights from logs
Auto-scaling#
Allows Nife to auto-scale your applications:
- Scale up under load
- Scale down when idle
- Cost optimization
- Performance tuning
Use when: Want automatic scaling
Deployment#
Allows deploying applications via Nife:
- Deploy from dashboard
- CI/CD integration
- Version management
- Rollback capability
Use when: Using Nife for deployments
Removing an Agent#
To remove an agent from a cluster:
- Go to Agents tab
- Select agent
- Click menu (three dots)
- Select Remove Agent
- Confirm removal
- Agent is removed from cluster
Note: Removing doesn't delete cluster, only removes agent service.
Best Practices#
1. Deploy to All Clusters#
Deploy at least one agent per cluster for monitoring and management.
2. Enable Recommended Capabilities#
Always enable: Monitoring, Logging, Security
3. Secure Your Tokens#
- Don't share agent tokens
- Store tokens securely
- Rotate tokens periodically
- Revoke compromised tokens
4. Monitor Agent Health#
- Check agent status regularly
- Monitor resource usage
- Review error logs
- Update agent when new versions available
5. Plan Deployment#
- Deploy during low-traffic periods
- Test in non-production first
- Have rollback plan
- Document deployment
6. Rotate Credentials Regularly#
- Rotate tokens monthly
- After team changes
- After security incidents
- As part of security policy
Agent Updates#
When agent updates are available:
- Notification appears in Nife
- New agent version is released
- You can update from dashboard
- Or manually update via kubectl
Update Process:
- New version is pulled
- Agent pods are recreated
- Zero downtime updates
- Capabilities are preserved
Next Steps#
- Monitor Resources - Track cluster health
- View Pod Logs - Access application logs
- Run Security Scans - Check cluster security
Support#
Questions about agents?
- Check this documentation
- Review agent logs
- Contact support: [email protected]
Agent not connecting?
- Follow troubleshooting section above
- Check cluster connectivity
- Verify token is valid
- Review agent pod logs