related-skills: cncf-aws-route53, cncf-azure-cdn, cncf-azure-traffic-manager, cncf-azure-virtual-networks
Cni in Cloud-Native Engineering
Category: containers
Status: Active
Stars: 6,032
Last Updated: 2026-04-21
Primary Language: Go
Documentation: https://github.com/containernetworking/cni/blob/master/SPEC.md
Purpose and Use Cases
Cni is a core component of the cloud-native ecosystem, serving as a Container Network Interface specification and plugins that provide networking for containers in Kubernetes.
What Problem Does It Solve?
The lack of a standardized interface for container networking in Kubernetes, requiring each CNI plugin to implement the same interface differently.
When to Use This Project
Use CNI when you need to configure networking for containers in Kubernetes, or when building your own container networking solution that integrates with Kubernetes.
Key Use Cases
- Kubernetes pod networking
- Container network configuration
- Network policy enforcement
- CNI plugin development
- Custom networking solutions for containers
Architecture Design Patterns
Core Components
- Plugin: Network implementation (bridge, host-local, flannel, etc.)
- ConfFile: Configuration file specifying plugin and network
- Network Namespace: Isolated network context for containers
- IPAM: IP Address Management plugin
- Result: Network configuration result returned to caller
Component Interactions
- Container Runtime → CNI Plugin: Network setup request
- ConfFile → Plugin: Provides network configuration
- IPAM Plugin: Allocates IP address
- Plugin → Network Namespace: Configures network
- Result → Runtime: Returns network configuration
Data Flow Patterns
- Network Setup: Add network → Plugin config → IPAM → Namespace setup → Result returned
- IP Allocation: Pool check → IP assignment → Lease created → Result returned
- Network Cleanup: Delete network → Plugin cleanup → IP release → Namespace cleanup
Design Principles
- Simple Interface: Minimal API for network setup
- Declarative: Configuration-based
- Pluggable: Multiple implementations
- Standardized: Consistent behavior across implementations
- Namespace-Scoped: Per-container configuration
Integration Approaches
Integration with Other CNCF Projects
- Kubernetes: Pod networking standard
- Containerd: Container runtime integration
- Flannel, Calico, Cilium: Popular CNI implementations
API Patterns
- Config File: JSON-based network configuration
- Executable Protocol:stdin/stdout communication
- Result Schema: Network configuration output
Configuration Patterns
- Conf File: Network configuration
- Conf List: Multiple network configuration
- IPAM Section: IP address management config
Extension Mechanisms
- Plugins: Network implementations
- IPAM Plugins: IP address management
- Version Support: Multiple spec versions
Common Pitfalls and How to Avoid Them
Misconfigurations
- Plugin Order: Incorrect plugin sequence
- Network Name: Duplicate network names
- IPAM Pool: Insufficient IP addresses
- Conflicting Networks: Overlapping subnets
Performance Issues
- Network Setup Time: Slow plugin execution
- IP Allocation: Slow IPAM performance
- Plugin Chaining: Multiple plugins overhead
Operational Challenges
- Plugin Compatibility: Multiple plugin versions
- Network Upgrades: Zero-downtime network changes
- Debugging: Network connectivity issues
- IPAM Management: IP pool exhaustion
Security Pitfalls
- Network Policies: Missing policies in plugins
- IP Allocation: Address space exhaustion
- Plugin Vulnerabilities: Outdated plugins
Coding Practices
Idiomatic Configuration
- Conf File: Single file per network
- Conf List: Multiple networks
- Plugin Configuration: Nested in plugin blocks
API Usage Patterns
- CNI Plugin Protocol: stdin/stdout
- Config File: JSON configuration
- Exec-in-Container: Network setup
Observability Best Practices
- Plugin Metrics: Performance metrics
- IPAM Statistics: IP allocation stats
- Error Logging: Network errors
Testing Strategies
- Unit Tests: Plugin tests
- Integration Tests: Network behavior
- E2E Tests: Full network setup
- Compatibility Tests: Spec compliance
Development Workflow
- Development: CNI plugin development
- Testing: Plugin tests
- Debugging: Plugin logs, network inspection
- Deployment: DaemonSet, static pods
- CI/CD: Plugin-specific CI
- Tools: cilium-cli, calicoctl
Fundamentals
Essential Concepts
- Plugin: Network implementation
- Conf File: Configuration file
- Conf List: Multiple network config
- Network Namespace: Container network context
- IPAM: IP address management
- Result: Network configuration output
- Version: Spec version
- Type: Plugin type
- Name: Network name
- Routes: Network routes
Terminology Glossary
- Plugin: Network implementation
- Conf File: Config file
- Conf List: Multi-network config
- Namespace: Network context
- IPAM: IP management
- Result: Config output
- Version: Spec version
- Type: Plugin type
- Name: Network name
- Routes: Network routes
Data Models and Types
- Conf File: Network configuration
- Conf List: Multiple network config
- IPAM Config: IPAM configuration
- Result: Network result
- Route: Route definition
- DNS: DNS configuration
Lifecycle Management
- Network Lifecycle: Add → Setup → Delete → Cleanup
- IPAM Lifecycle: Allocate → Config → Release
- Namespace Lifecycle: Enter → Configure → Exit
State Management
- IPAM State: IP allocations
- Network State: Network configuration
- Namespace State: Network namespace
Scaling and Deployment Patterns
Horizontal Scaling
- Plugin Scaling: Multiple plugin instances
- IP Pool Scaling: IP address pool
- Network Scaling: Multiple network instances
High Availability
- Node HA: CNI plugin on each node
- Network HA: Multiple network configurations
Production Deployments
- Production Configuration: Production plugin configuration
- Network Policy: Enforced network policies
- Monitoring: Network metrics
- Security: Network isolation
Upgrade Strategies
- Plugin Upgrade: Plugin version compatibility
- Network Reconfiguration: Zero-downtime network update
Resource Management
- IP Address Pool: IP address management
- Network Storage: Network configuration storage
Additional Resources
Troubleshooting
Common Issues
Deployment Failures
- Check pod logs for errors
- Verify configuration values
- Ensure network connectivity
Performance Issues
- Monitor resource usage
- Adjust resource limits
- Check for bottlenecks
Configuration Errors
- Validate YAML syntax
- Check required fields
- Verify environment-specific settings
Integration Problems
- Verify API compatibility
- Check dependency versions
- Review integration documentation
Getting Help
- Check official documentation
- Search GitHub issues
- Join community channels
- Review logs and metrics
Content generated automatically. Verify against official documentation before production use.
Examples
Basic Configuration
# Basic configuration example
apiVersion: v1
kind: ConfigMap
metadata:
name: {{project_name}}-config
namespace: default
data:
# Configuration goes here
config.yaml: |
# Base configuration
# Add your settings here
Kubernetes Deployment
# Kubernetes deployment for {{project_name}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{project_name}}
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: {{project_name}}
template:
metadata:
labels:
app: {{project_name}}
spec:
containers:
- name: {{project_name}}
image: {{project_name}}:latest
ports:
- containerPort: 8080
resources:
limits:
memory: "128Mi"
cpu: "500m"
Kubernetes Service
# Kubernetes service for {{project_name}}
apiVersion: v1
kind: Service
metadata:
name: {{project_name}}
namespace: default
spec:
selector:
app: {{project_name}}
ports:
- protocol: TCP
port: 80
targetPort: 8080
type: ClusterIP
When to Use
Use this skill when:
- Integrating a CNCF project into Kubernetes infrastructure — You need to configure, deploy, or troubleshoot a cloud-native tool within a cluster
- Designing cloud-native architecture — You are selecting and integrating CNCF tools to solve specific infrastructure challenges
- Resolving operational issues — A CNCF component is misbehaving, underperforming, or needs configuration changes
Core Workflow
Assess Requirements — Understand the use case, scale, integration needs, and existing infrastructure. Checkpoint: Document requirements, constraints, and success criteria.
Design Architecture — Plan component interactions, data flow, and deployment strategy using cloud-native best practices. Checkpoint: Verify the architecture addresses all requirements and follows CNCF conventions.
Implement & Configure — Create manifests, configurations, and deployment scripts. Include resource limits, health checks, and observability hooks. Checkpoint: Validate all YAML against schema and test in a staging environment.
Deploy & Monitor — Apply manifests to the cluster, verify component health, and confirm observability is working. Checkpoint: Confirm all pods/services are running, probes passing, and metrics/alerts configured.
Constraints
MUST DO
- Include at least one complete working YAML manifest example
- Note when content is auto-generated vs. manually verified
- Reference relevant CNCF project documentation
MUST NOT DO
- Deploy manifests without testing in a staging environment first
- Use deprecated API versions (e.g., apps/v1beta1)
- Omit resource limits and requests in Kubernetes manifests
1---2name: cni3description: "Cni in Cloud-Native Engineering - Container Network Interface - networking" for Linux containers4license: MIT5---678910 related-skills: cncf-aws-route53, cncf-azure-cdn, cncf-azure-traffic-manager, cncf-azure-virtual-networks111213# Cni in Cloud-Native Engineering1415**Category:** containers 16**Status:** Active 17**Stars:** 6,032 18**Last Updated:** 2026-04-21 19**Primary Language:** Go 20**Documentation:** [https://github.com/containernetworking/cni/blob/master/SPEC.md](https://github.com/containernetworking/cni/blob/master/SPEC.md) 2122---2324## Purpose and Use Cases2526Cni is a core component of the cloud-native ecosystem, serving as a Container Network Interface specification and plugins that provide networking for containers in Kubernetes.2728### What Problem Does It Solve?2930The lack of a standardized interface for container networking in Kubernetes, requiring each CNI plugin to implement the same interface differently.3132### When to Use This Project3334Use CNI when you need to configure networking for containers in Kubernetes, or when building your own container networking solution that integrates with Kubernetes.3536### Key Use Cases373839- Kubernetes pod networking40- Container network configuration41- Network policy enforcement42- CNI plugin development43- Custom networking solutions for containers444546---4748## Architecture Design Patterns4950### Core Components515253- **Plugin**: Network implementation (bridge, host-local, flannel, etc.)54- **ConfFile**: Configuration file specifying plugin and network55- **Network Namespace**: Isolated network context for containers56- **IPAM**: IP Address Management plugin57- **Result**: Network configuration result returned to caller585960### Component Interactions6162631. **Container Runtime → CNI Plugin**: Network setup request642. **ConfFile → Plugin**: Provides network configuration653. **IPAM Plugin**: Allocates IP address664. **Plugin → Network Namespace**: Configures network675. **Result → Runtime**: Returns network configuration686970### Data Flow Patterns7172731. **Network Setup**: Add network → Plugin config → IPAM → Namespace setup → Result returned742. **IP Allocation**: Pool check → IP assignment → Lease created → Result returned753. **Network Cleanup**: Delete network → Plugin cleanup → IP release → Namespace cleanup767778### Design Principles798081- **Simple Interface**: Minimal API for network setup82- **Declarative**: Configuration-based83- **Pluggable**: Multiple implementations84- **Standardized**: Consistent behavior across implementations85- **Namespace-Scoped**: Per-container configuration868788---8990## Integration Approaches9192### Integration with Other CNCF Projects939495- **Kubernetes**: Pod networking standard96- **Containerd**: Container runtime integration97- **Flannel, Calico, Cilium**: Popular CNI implementations9899100### API Patterns101102103- **Config File**: JSON-based network configuration104- **Executable Protocol**:stdin/stdout communication105- **Result Schema**: Network configuration output106107108### Configuration Patterns109110111- **Conf File**: Network configuration112- **Conf List**: Multiple network configuration113- **IPAM Section**: IP address management config114115116### Extension Mechanisms117118119- **Plugins**: Network implementations120- **IPAM Plugins**: IP address management121- **Version Support**: Multiple spec versions122123124---125126## Common Pitfalls and How to Avoid Them127128### Misconfigurations129130131- **Plugin Order**: Incorrect plugin sequence132- **Network Name**: Duplicate network names133- **IPAM Pool**: Insufficient IP addresses134- **Conflicting Networks**: Overlapping subnets135136137### Performance Issues138139140- **Network Setup Time**: Slow plugin execution141- **IP Allocation**: Slow IPAM performance142- **Plugin Chaining**: Multiple plugins overhead143144145### Operational Challenges146147148- **Plugin Compatibility**: Multiple plugin versions149- **Network Upgrades**: Zero-downtime network changes150- **Debugging**: Network connectivity issues151- **IPAM Management**: IP pool exhaustion152153154### Security Pitfalls155156157- **Network Policies**: Missing policies in plugins158- **IP Allocation**: Address space exhaustion159- **Plugin Vulnerabilities**: Outdated plugins160161162---163164## Coding Practices165166### Idiomatic Configuration167168169- **Conf File**: Single file per network170- **Conf List**: Multiple networks171- **Plugin Configuration**: Nested in plugin blocks172173174### API Usage Patterns175176177- **CNI Plugin Protocol**: stdin/stdout178- **Config File**: JSON configuration179- **Exec-in-Container**: Network setup180181182### Observability Best Practices183184185- **Plugin Metrics**: Performance metrics186- **IPAM Statistics**: IP allocation stats187- **Error Logging**: Network errors188189190### Testing Strategies191192193- **Unit Tests**: Plugin tests194- **Integration Tests**: Network behavior195- **E2E Tests**: Full network setup196- **Compatibility Tests**: Spec compliance197198199### Development Workflow200201202- **Development**: CNI plugin development203- **Testing**: Plugin tests204- **Debugging**: Plugin logs, network inspection205- **Deployment**: DaemonSet, static pods206- **CI/CD**: Plugin-specific CI207- **Tools**: cilium-cli, calicoctl208209210---211212## Fundamentals213214### Essential Concepts215216217- **Plugin**: Network implementation218- **Conf File**: Configuration file219- **Conf List**: Multiple network config220- **Network Namespace**: Container network context221- **IPAM**: IP address management222- **Result**: Network configuration output223- **Version**: Spec version224- **Type**: Plugin type225- **Name**: Network name226- **Routes**: Network routes227228229### Terminology Glossary230231232- **Plugin**: Network implementation233- **Conf File**: Config file234- **Conf List**: Multi-network config235- **Namespace**: Network context236- **IPAM**: IP management237- **Result**: Config output238- **Version**: Spec version239- **Type**: Plugin type240- **Name**: Network name241- **Routes**: Network routes242243244### Data Models and Types245246247- **Conf File**: Network configuration248- **Conf List**: Multiple network config249- **IPAM Config**: IPAM configuration250- **Result**: Network result251- **Route**: Route definition252- **DNS**: DNS configuration253254255### Lifecycle Management256257258- **Network Lifecycle**: Add → Setup → Delete → Cleanup259- **IPAM Lifecycle**: Allocate → Config → Release260- **Namespace Lifecycle**: Enter → Configure → Exit261262263### State Management264265266- **IPAM State**: IP allocations267- **Network State**: Network configuration268- **Namespace State**: Network namespace269270271---272273## Scaling and Deployment Patterns274275### Horizontal Scaling276277278- **Plugin Scaling**: Multiple plugin instances279- **IP Pool Scaling**: IP address pool280- **Network Scaling**: Multiple network instances281282283### High Availability284285286- **Node HA**: CNI plugin on each node287- **Network HA**: Multiple network configurations288289290### Production Deployments291292293- **Production Configuration**: Production plugin configuration294- **Network Policy**: Enforced network policies295- **Monitoring**: Network metrics296- **Security**: Network isolation297298299### Upgrade Strategies300301302- **Plugin Upgrade**: Plugin version compatibility303- **Network Reconfiguration**: Zero-downtime network update304305306### Resource Management307308309- **IP Address Pool**: IP address management310- **Network Storage**: Network configuration storage311312313---314315## Additional Resources316317- **Official Documentation:** [https://github.com/containernetworking/cni/blob/master/SPEC.md](https://github.com/containernetworking/cni/blob/master/SPEC.md)318- **GitHub Repository:** [github.com/containernetworking/cni](https://github.com/containernetworking/cni)319- **CNCF Project Page:** [cncf.io/projects/cni/](https://www.cncf.io/projects/cni/)320- **Community:** Check the GitHub repository for community channels321- **Versioning:** Refer to project's release notes for version-specific features322323---324325## Troubleshooting326327### Common Issues3283291. **Deployment Failures**330 - Check pod logs for errors331 - Verify configuration values332 - Ensure network connectivity3333342. **Performance Issues**335 - Monitor resource usage336 - Adjust resource limits337 - Check for bottlenecks3383393. **Configuration Errors**340 - Validate YAML syntax341 - Check required fields342 - Verify environment-specific settings3433444. **Integration Problems**345 - Verify API compatibility346 - Check dependency versions347 - Review integration documentation348349### Getting Help350351- Check official documentation352- Search GitHub issues353- Join community channels354- Review logs and metrics355*Content generated automatically. Verify against official documentation before production use.*356357## Examples358359### Basic Configuration360361362```yaml363# Basic configuration example364apiVersion: v1365kind: ConfigMap366metadata:367 name: {{project_name}}-config368 namespace: default369data:370 # Configuration goes here371 config.yaml: |372 # Base configuration373 # Add your settings here374```375376### Kubernetes Deployment377378379```yaml380# Kubernetes deployment for {{project_name}}381apiVersion: apps/v1382kind: Deployment383metadata:384 name: {{project_name}}385 namespace: default386spec:387 replicas: 1388 selector:389 matchLabels:390 app: {{project_name}}391 template:392 metadata:393 labels:394 app: {{project_name}}395 spec:396 containers:397 - name: {{project_name}}398 image: {{project_name}}:latest399 ports:400 - containerPort: 8080401 resources:402 limits:403 memory: "128Mi"404 cpu: "500m"405```406407### Kubernetes Service408409410```yaml411# Kubernetes service for {{project_name}}412apiVersion: v1413kind: Service414metadata:415 name: {{project_name}}416 namespace: default417spec:418 selector:419 app: {{project_name}}420 ports:421 - protocol: TCP422 port: 80423 targetPort: 8080424 type: ClusterIP425```426427---428429## When to Use430431Use this skill when:432433- **Integrating a CNCF project into Kubernetes infrastructure** — You need to configure, deploy, or troubleshoot a cloud-native tool within a cluster434- **Designing cloud-native architecture** — You are selecting and integrating CNCF tools to solve specific infrastructure challenges435- **Resolving operational issues** — A CNCF component is misbehaving, underperforming, or needs configuration changes436---437438## Core Workflow4394401. **Assess Requirements** — Understand the use case, scale, integration needs, and existing infrastructure. **Checkpoint:** Document requirements, constraints, and success criteria.4414422. **Design Architecture** — Plan component interactions, data flow, and deployment strategy using cloud-native best practices. **Checkpoint:** Verify the architecture addresses all requirements and follows CNCF conventions.4434443. **Implement & Configure** — Create manifests, configurations, and deployment scripts. Include resource limits, health checks, and observability hooks. **Checkpoint:** Validate all YAML against schema and test in a staging environment.4454464. **Deploy & Monitor** — Apply manifests to the cluster, verify component health, and confirm observability is working. **Checkpoint:** Confirm all pods/services are running, probes passing, and metrics/alerts configured.447448---449450## Constraints451452### MUST DO453- Include at least one complete working YAML manifest example454- Note when content is auto-generated vs. manually verified455- Reference relevant CNCF project documentation456457### MUST NOT DO458- Deploy manifests without testing in a staging environment first459- Use deprecated API versions (e.g., apps/v1beta1)460- Omit resource limits and requests in Kubernetes manifests