Issue
The deployment pipeline encountered three critical issues that blocked infrastructure updates:
- FluxCD Helm deployment failures due to unsupported OCI registry protocols, preventing the use of updated Helm charts.
- GitHub Actions security scanning warnings caused by missing permissions for SARIF uploads, disrupting security compliance workflows.
- Docker production images containing development-specific files and improper secrets management, violating security and operational best practices.
These issues collectively prevented the successful deployment of infrastructure components, such as Redis, and introduced security and compliance risks.
Culprit
OCI Registry Migration
A migration from traditional HTTP Helm repositories to OCI-based registries by the Helm chart provider (e.g., Bitnami) introduced compatibility issues with FluxCD. The existing FluxCD HelmRepository configurations were designed for HTTP-based repositories and could not directly support the new OCI protocol (oci://), causing deployment failures.
GitHub Actions Permissions
The CI/CD pipeline lacked the necessary security-events: write permission, which is required for uploading SARIF files generated by security scanning tools (e.g., Trivy). Without this permission, GitHub Actions continued to produce warnings, impacting the reliability of the security compliance process.
Docker Production Readiness
The Docker images included development-specific files (e.g., .env.example) and did not utilize the intended secrets management solution (e.g., Azure Key Vault CSI driver). This violated security best practices by embedding sensitive or non-production artifacts in the final images.
Solution
OCI Registry Migration
To resolve the OCI registry issue:
- Update FluxCD Configuration: Replace
HelmRepositoryresources withOCIRepositoryresources to support the new OCI-based Helm charts. - Reference OCI Repository: Ensure that
HelmReleaseconfigurations reference the newly createdOCIRepositoryinstead of outdated HTTP-based repositories.
This change enables FluxCD to pull and deploy Helm charts from OCI registries, resolving the deployment failures.
GitHub Actions SARIF Upload
To address the GitHub Actions security scanning issue:
- Modify Workflow: Update the GitHub Actions workflow to include the
continue-on-error: trueflag for SARIF uploads, ensuring that security scanning does not block the build pipeline. - Verify Permissions: Ensure that the repository has the appropriate permissions for uploading SARIF files to GitHub Code Scanning.
This resolves the warnings and ensures that security scanning remains an integral part of the CI/CD process.
Docker Production Readiness
To improve Docker image production readiness:
- Remove Development Files: Exclude development-specific files (e.g.,
.env.example) from the Docker build process. - Implement Secrets Management: Use a secure secrets management solution (e.g., CSI driver for cloud-based key vaults) to inject secrets at runtime, rather than embedding them in the image.
This ensures that production images are secure, compliant, and aligned with operational best practices.
Resource Optimization
Optimize resource usage in the Kubernetes cluster by:
- Disabling Unnecessary Components: Turn off non-critical components (e.g., policy enforcement tools) to free up CPU resources.
- Minimizing Monitoring Overhead: Reduce resource allocations for monitoring tools to ensure sufficient capacity for critical workloads.
- Constraining Controller Resources: Limit CPU allocations for FluxCD controllers to prevent resource exhaustion in single-node clusters.
Verification
After applying the fixes:
- OCI Registry: Confirm that FluxCD successfully pulls and deploys Helm charts from the OCI registry.
- GitHub Actions: Verify that SARIF uploads complete without errors, and security scanning remains active.
- Docker Images: Ensure that production images exclude development files and use secure secrets management.
- Resource Utilization: Monitor CPU and memory usage to confirm that the cluster operates within expected limits.
This approach ensures a secure, compliant, and efficient deployment pipeline while addressing the root causes of the issues.