yaml
131 lines · 1 tab
Ryan Nakamura
Feb 2026
1 tab
# === ArgoCD Application: Single app deployment ===
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp-production
namespace: argocd
labels:
team: platform
environment: production
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: production
source:
repoURL: https://github.com/myorg/k8s-manifests.git
targetRevision: main
path: environments/production/myapp
# For Helm charts:
# helm:
# valueFiles:
# - values-production.yaml
# parameters:
# - name: image.tag
# value: "v1.2.3"
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true # Delete resources removed from git
selfHeal: true # Revert manual changes in cluster
allowEmpty: false # Don't sync if manifests are empty
syncOptions:
- CreateNamespace=true
- PrunePropagationPolicy=foreground
- PruneLast=true # Prune after other syncs complete
- ApplyOutOfSyncOnly=true
- ServerSideApply=true
retry:
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m
# Health checks and status
ignoreDifferences:
- group: apps
kind: Deployment
jsonPointers:
- /spec/replicas # Ignore HPA-managed replica count
info:
- name: url
value: https://myapp.example.com
---
# === ArgoCD ApplicationSet: Multi-environment generator ===
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: myapp-environments
namespace: argocd
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- list:
elements:
- env: staging
cluster: https://kubernetes.default.svc
namespace: staging
autoSync: true
branch: develop
- env: production
cluster: https://kubernetes.default.svc
namespace: production
autoSync: false # Manual approval for production
branch: main
template:
metadata:
name: "myapp-{{ .env }}"
namespace: argocd
labels:
environment: "{{ .env }}"
spec:
project: "{{ .env }}"
source:
repoURL: https://github.com/myorg/k8s-manifests.git
targetRevision: "{{ .branch }}"
path: "environments/{{ .env }}/myapp"
destination:
server: "{{ .cluster }}"
namespace: "{{ .namespace }}"
syncPolicy:
syncOptions:
- CreateNamespace=true
- ServerSideApply=true
---
# === ArgoCD Project: RBAC and source restrictions ===
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: production
namespace: argocd
spec:
description: Production environment project
sourceRepos:
- https://github.com/myorg/k8s-manifests.git
- https://charts.example.com
destinations:
- server: https://kubernetes.default.svc
namespace: production
name: in-cluster
clusterResourceWhitelist:
- group: ""
kind: Namespace
namespaceResourceWhitelist:
- group: "*"
kind: "*"
roles:
- name: deployer
description: Can sync applications
policies:
- p, proj:production:deployer, applications, sync, production/*, allow
- p, proj:production:deployer, applications, get, production/*, allow
groups:
- platform-team
1 file · yaml
Explain with highlit
Implement GitOps with ArgoCD for declarative, git-driven Kubernetes deployments. Configure Application and ApplicationSet resources, automated sync policies, health checks, and multi-environment promotion. Keep your cluster state in sync with your Git repository.
Related snips
ruby
require "timeout"
module HealthCheck
class Probe
Result = Struct.new(:name, :status, :latency_ms, :critical, :error, keyword_init: true) do
def healthy?
Health Check Endpoint with Dependency Probes
rails
reliability
health-check
by codesnips
3 tabs
javascript
// Express app with health checks and graceful shutdown
const express = require('express');
const { createServer } = require('http');
const app = express();
const server = createServer(app);
Container health checks and graceful shutdown patterns
docker
kubernetes
health-checks
by Ryan Nakamura
1 tab
yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: metrics-reader
namespace: production
---
Kubernetes RBAC roles with least privilege service accounts
kubernetes
rbac
least-privilege
by Kai Nakamura
1 tab
yaml
# Headless Service for stable DNS
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: production
Kubernetes StatefulSets for stateful workloads
kubernetes
k8s
statefulsets
by Ryan Nakamura
1 tab
ruby
# Fastlane Fastfile for automated deployment
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
App Store submission and TestFlight beta testing
ios
app-store
testflight
by Sofia Martinez
2 tabs
yaml
# === One-off Job: Database migration ===
apiVersion: batch/v1
kind: Job
metadata:
name: db-migrate
namespace: production
Kubernetes Jobs and CronJobs for batch workloads
kubernetes
cronjob
batch
by Ryan Nakamura
1 tab
Share this code
Here's the card — post it anywhere.