Skip to content

Add ArgoCD app and deployment manifests #1644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"posts": [
{ "id": 1, "title": "Hello World" },
{ "id": 2, "title": "GitOps is cool!" }
]
}
13 changes: 13 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

FROM node:18

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 3000

CMD ["npx", "json-server", "db.json", "--host", "0.0.0.0", "--port", "3000"]
37 changes: 37 additions & 0 deletions k8s/manifests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ⚙️ GitOps with ArgoCD – JSON Server Demo

This project demonstrates a **GitOps workflow using ArgoCD** to automatically deploy a simple `json-server` application to a Kubernetes cluster.

📌 **Showcase Ready** — You can include this in your resume or portfolio to demonstrate your understanding of:
- Kubernetes deployment workflows
- GitOps principles
- ArgoCD for continuous delivery
- Docker-based microservices

---

## 🔍 What This Project Demonstrates

- 🎯 Deploying a demo app (`json-server`) using ArgoCD
- 📂 Managing Kubernetes manifests declaratively from Git
- 🔄 Continuous sync between Git and the cluster
- 🛠 Rollbacks, health checks, and namespace scoping
- 🔧 Manual + automatic deployment syncing

---

## 🗂 Project Structure

- ├── manifests/
- │ ├── deployment.yaml
- │ └── service.yaml
- └── Dockerfile


---

## 🚀 Quick Start Instructions

### 🧩 ArgoCD Setup

If you haven’t installed ArgoCD yet, follow the [Setup Guide](./setup.md).
20 changes: 20 additions & 0 deletions k8s/manifests/argocd-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: json-server-app
namespace: argocd
spec:
project: default
source:
repoURL: 'https://github.com/sthitajoshi/json-server'
targetRevision: HEAD
path: k8s/manifests
destination:
server: 'https://kubernetes.default.svc'
namespace: default
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
20 changes: 20 additions & 0 deletions k8s/manifests/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: json-server
namespace: json-server
spec:
replicas: 1
selector:
matchLabels:
app: json-server
template:
metadata:
labels:
app: json-server
spec:
containers:
- name: json-server
image: shtita09/json-server-demo:latest
ports:
- containerPort: 3000
13 changes: 13 additions & 0 deletions k8s/manifests/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: json-server-service
namespace: json-server
spec:
selector:
app: json-server
ports:
- protocol: TCP
port: 80
targetPort: 3000
type: NodePort
76 changes: 52 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@
"typescript-eslint": "^8.6.0"
},
"dependencies": {
"@tinyhttp/app": "^2.4.0",
"@tinyhttp/app": "^2.5.2",
"@tinyhttp/cors": "^2.0.1",
"@tinyhttp/logger": "^2.0.0",
"chalk": "^5.3.0",
"chokidar": "^4.0.1",
"dot-prop": "^9.0.0",
"eta": "^3.5.0",
"inflection": "^3.0.0",
"json-server": "^1.0.0-beta.3",
"json5": "^2.2.3",
"lowdb": "^7.0.1",
"milliparsec": "^4.0.0",
Expand Down
13 changes: 13 additions & 0 deletions setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Install ArgoCD on Kubernetes

# 1. Create ArgoCD namespace
kubectl create namespace argocd

# 2. Install ArgoCD
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

# 3. Expose ArgoCD UI (optional, for local testing)
kubectl port-forward svc/argocd-server -n argocd 8080:443

# 4. Get the initial admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d