Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

Gaurav Agarwal bharatmicrosystems

😀
View GitHub Profile
View nginx-fine-grained.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
spec:
securityContext:
seccompProfile:
type: Localhost
View setup-argo.yml
name: Create Kubernetes Cluster and Install Argo
on: push
jobs:
deploy-terraform:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./terraform
steps:
- uses: actions/checkout@v2
View my-nginx-app.tf
data "kubectl_file_documents" "my-nginx-app" {
content = file("../manifests/argocd/my-nginx-app.yaml")
}
resource "kubectl_manifest" "my-nginx-app" {
depends_on = [
kubectl_manifest.argocd,
]
count = length(data.kubectl_file_documents.my-nginx-app.documents)
yaml_body = element(data.kubectl_file_documents.my-nginx-app.documents, count.index)
View my-nginx-app.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-nginx
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
View nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
spec:
selector:
matchLabels:
run: my-nginx
replicas: 2
template:
View install-argocd.yaml
provider "kubectl" {
host = module.gke_auth.host
cluster_ca_certificate = module.gke_auth.cluster_ca_certificate
token = module.gke_auth.token
load_config_file = false
}
data "kubectl_file_documents" "namespace" {
content = file("../manifests/argocd/namespace.yaml")
}
View namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: argocd
View gke.tf
provider "google" {
project = var.project_id
region = var.region
zone = var.location
}
resource "google_service_account" "main" {
account_id = "${var.cluster_name}-sa"
display_name = "GKE Cluster ${var.cluster_name} Service Account"
}
View backend.tf
terraform {
required_version = ">= 0.13"
required_providers {
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.7.0"
}
}
backend "gcs" {
bucket = "terraform-backend-<project-id>"
View nginx-deployment.yaml
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2