add nginx deployment test

This commit is contained in:
K3s Admin
2026-01-21 09:45:33 +00:00
parent b7e63dc39c
commit 33f803c82f
3 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-test
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:stable-alpine
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP

View File

@@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: k3s-configs-app
namespace: argocd # 必须部署在 ArgoCD 所在的命名空间
spec:
project: default # 使用默认项目
source:
repoURL: 'https://git.u9.net3w.com/fei/k3s-configs.git'
targetRevision: HEAD # 对应主分支main/master
path: '.' # 配置文件在仓库中的根目录
destination:
server: 'https://kubernetes.default.svc' # 部署到 ArgoCD 所在的当前集群
namespace: my-deploy-ns # 目标命名空间(会自动在该下创建资源)
# 自动化部署的关键配置
syncPolicy:
automated:
prune: true # 自动删除 Git 中已不存在的资源
selfHeal: true # 如果手动改了集群ArgoCD 会自动修复回 Git 的状态
syncOptions:
- CreateNamespace=true # 如果目标命名空间不存在,则自动创建

View File

@@ -0,0 +1 @@
kubectl apply -f my-app-argocd.yaml