Auto Import Configurations
kftray can automatically import port forward configurations from Kubernetes Service annotations, streamlining setup and maintaining consistency.
for a detailed guide, please refer to Auto Import
Annotation Format
Add the following annotation to your Kubernetes Services:
apiVersion: v1
kind: Service
metadata:
name: my-service
annotations:
kftray.app/enabled: true
kftray.app/configs: "test-9999-http"
spec:
ports:
- port: 80
Configuration Fields
The annotation JSON supports these fields:
enabled
: Enable auto importconfigs
: Configuration alias, local port, remote port
Using Auto Import
In KFtray
- Click menu icon
- Select "Auto Import"
- Choose kubeconfig file
- Select context
- Click "Import"
In KFtui
- Press
Tab
for menu - Select "Auto Import"
- Select configurations
- Press
f
to start
Example Configurations
Web Application
apiVersion: v1
kind: Service
metadata:
name: frontend
annotations:
kftray.app/enabled: true
kftray.app/configs: "frontend-9999-80"
spec:
ports:
- port: 80
Database
apiVersion: v1
kind: Service
metadata:
name: database
annotations:
kftray.app/enabled: true
kftray.app/configs: "database-9999-5432"
spec:
ports:
- port: 5432
Best Practices
- Naming Conventions
- Use consistent aliases
- Include service purpose
- Follow team standards
- Port Management
- Avoid port conflicts
- Document port assignments
- Use standard ports
- Organization
- Group related services
- Maintain documentation
- Regular configuration review
Terraform Integration
Example Terraform configuration:
resource "kubernetes_service" "example" {
metadata {
name = "example-service"
annotations = {
"kftray.app/enabled" = true
"kftray.app/configs" = "test-9999-http"
}
}
spec {
port {
port = 80
}
}
}
Troubleshooting
Common issues and solutions:
- Import Fails
- Verify annotation format
- Check JSON syntax
- Confirm service exists
- Port Conflicts
- Review local ports
- Check running services
- Update port numbers
- Missing Services
- Verify namespace access
- Check context selection
- Review RBAC permissions