You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求提供ArgoCD+Kustomize部署多服务与Camel-K集成的完整示例并验证流程正确性

Your Workflow Assessment

Your proposed flow has a solid core but includes a critical optimization: instead of using a manually generated deployment.yaml from kamel run, you should leverage Camel-K's native Integration CRD. This lets the Camel-K operator handle image building, lifecycle management, and Camel-specific features (like auto-scaling and route updates) automatically. Additionally, structuring environment-specific configurations with Kustomize overlays will make your ArgoCD deployment far more maintainable across dev/test/prod.


Complete ArgoCD + Camel-K Deployment Example

1. Repository Structure

camel-k-argocd-demo/
├── base/
│   ├── integration.yaml       # Core Camel-K Integration definition
│   ├── service.yaml           # Kubernetes Service for the Camel app
│   ├── ingress.yaml           # Ingress routing config
│   └── kustomization.yaml     # Base Kustomize bundling config
├── overlays/
│   ├── dev/
│   │   ├── integration-patch.yaml  # Dev-specific resource limits
│   │   ├── ingress-patch.yaml      # Dev ingress host
│   │   └── kustomization.yaml
│   ├── test/
│   │   ├── integration-patch.yaml
│   │   ├── ingress-patch.yaml
│   │   └── kustomization.yaml
│   └── prod/
│       ├── integration-patch.yaml
│       ├── ingress-patch.yaml
│       └── kustomization.yaml
├── route/
│   └── Hello.java             # Camel route source code
└── argocd-applications/
    ├── dev-app.yaml           # ArgoCD Application for dev env
    ├── test-app.yaml          # ArgoCD Application for test env
    └── prod-app.yaml          # ArgoCD Application for prod env

2. Core Resource Files

base/integration.yaml

Defines the Camel-K Integration, linking directly to your route source in Git:

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: hello-camel
spec:
  sources:
    - uri: git:https://gitlab.com/your-username/camel-k-argocd-demo?path=route/Hello.java
  profile: Kubernetes

base/service.yaml

Exposes the Camel app as a ClusterIP service:

apiVersion: v1
kind: Service
metadata:
  name: hello-camel-service
spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: 8080
      name: http
  selector:
    camel.apache.org/integration: hello-camel

base/ingress.yaml

Basic ingress configuration (adjust for your cluster's ingress controller):

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello-camel-ingress
spec:
  rules:
    - http:
        paths:
          - path: /hello
            pathType: Prefix
            backend:
              service:
                name: hello-camel-service
                port:
                  number: 80

base/kustomization.yaml

Bundles all base resources for reuse across environments:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - integration.yaml
  - service.yaml
  - ingress.yaml

3. Environment-Specific Overlays

overlays/dev/integration-patch.yaml

Tweak resource limits for the dev environment:

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: hello-camel
spec:
  resources:
    requests:
      cpu: "100m"
      memory: "256Mi"
    limits:
      cpu: "500m"
      memory: "512Mi"

overlays/dev/ingress-patch.yaml

Set a dev-specific ingress host:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello-camel-ingress
spec:
  rules:
    - host: hello-dev.your-domain.com
      http:
        paths:
          - path: /hello
            pathType: Prefix
            backend:
              service:
                name: hello-camel-service
                port:
                  number: 80

overlays/dev/kustomization.yaml

Links base resources and applies dev patches:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
  - ../../base
patchesStrategicMerge:
  - integration-patch.yaml
  - ingress-patch.yaml
namespace: dev

Repeat similar patch files for test and prod with appropriate resource limits, hosts, and namespaces.

4. ArgoCD Application Definitions

argocd-applications/dev-app.yaml

Defines the ArgoCD Application for the dev environment:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: hello-camel-dev
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://gitlab.com/your-username/camel-k-argocd-demo.git
    targetRevision: main
    path: overlays/dev
  destination:
    server: https://kubernetes.default.svc
    namespace: dev
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

Create identical files for test and prod by updating the name, path, and namespace fields.

5. Deployment Steps

  1. Push to GitLab: Commit and push the entire repository structure to your GitLab repo.
  2. Deploy ArgoCD Applications:
    • Option 1: Apply the YAMLs directly: kubectl apply -f argocd-applications/
    • Option 2: Use the ArgoCD UI to create each application manually, specifying the Git repo path (e.g., overlays/dev) and target namespace.
  3. Verify:
    • Check the ArgoCD UI for successful sync status.
    • Use kubectl get integrations -n dev to confirm the Camel-K Integration is running.
    • Access the app via the ingress host (e.g., http://hello-dev.your-domain.com/hello).

Key Notes

  • Ensure the Camel-K operator is installed in your Kubernetes cluster before deploying.
  • The Integration's sources.uri pulls the route directly from Git—Camel-K will automatically rebuild the app when route code changes.
  • Automated sync in ArgoCD keeps your cluster state aligned with Git, triggering updates whenever you push changes to base or overlay files.

内容的提问来源于stack exchange,提问作者Martel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 12:44:52