Fleet is a GitOps agent that deploys and manages Kubernetes clusters by synchronizing their state with Git repositories. Rancher Pipelines, on the other hand, is a CI/CD system that builds, tests, and deploys applications to Kubernetes clusters. While both tools are used in the Kubernetes ecosystem, they serve different purposes and have different architectures.

Here’s how Fleet and Tekton can be used to migrate off Rancher Pipelines:

Fleet for GitOps

Fleet is a good choice for migrating off Rancher Pipelines if your primary goal is to adopt a GitOps workflow for managing your cluster configurations and application deployments. Fleet allows you to define the desired state of your clusters in Git, and Fleet agents on your clusters will automatically reconcile the actual state with the desired state.

Key concepts of Fleet:

  • Git Repository: You store your Kubernetes manifests (Deployments, Services, ConfigMaps, etc.) and cluster configurations in a Git repository.
  • Fleet Agent: A small agent deployed on each Kubernetes cluster that monitors the Git repository for changes.
  • Bundle: A collection of Git resources (manifests, Helm charts) that Fleet deploys to a cluster.
  • Cluster Group: A logical grouping of clusters that share the same set of bundles.

Migration Steps with Fleet:

  1. Organize your GitOps repository: Structure your Git repository to hold your Kubernetes manifests and Helm charts. This will be your single source of truth for cluster state.
  2. Install Fleet: Deploy Fleet to your management cluster.
  3. Create Bundles: Define your application deployments and cluster configurations as Fleet bundles. These bundles will point to specific paths within your GitOps repository.
  4. Assign Bundles to Cluster Groups: Create cluster groups and assign the relevant bundles to them. This tells Fleet which applications and configurations should be deployed to which clusters.
  5. Deploy Fleet Agents: Deploy Fleet agents to your target clusters. These agents will pull down the bundles and apply them to their respective clusters.
  6. Monitor and Verify: Use Fleet’s UI or CLI to monitor the deployment status of your bundles and verify that your applications are running as expected.

Example Fleet Configuration (Conceptual):

# In your GitOps repository (e.g., gitops-repo/apps/my-app/deployment.yaml)
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app-container
        image: nginx:latest
        ports:
        - containerPort: 80

# In Fleet's bundle definition (e.g., fleet/bundles/my-app-bundle.yaml)
apiVersion: fleet.cattle.io/v1alpha1
kind: Bundle
metadata:
  name: my-app-bundle
spec:
  source:
    repoURL: <your-gitops-repo-url>
    path: apps/my-app
  clusterSelector:
    matchLabels:
      environment: production

Tekton for CI/CD Pipelines

If your primary concern is replacing the CI/CD functionality of Rancher Pipelines (building images, running tests, deploying), then Tekton is the more direct replacement. Tekton is a Kubernetes-native CI/CD framework that provides a set of Kubernetes Custom Resources (CRDs) for defining and executing CI/CD pipelines.

Key concepts of Tekton:

  • Pipeline: A sequence of Tasks that are executed in a specific order.
  • Task: A collection of Steps that define a unit of work, such as building a Docker image or running a test.
  • Step: A single command or script that runs within a Task.
  • PipelineRun: An instance of a Pipeline that is executed.
  • TaskRun: An instance of a Task that is executed.
  • tkn CLI: A command-line tool for interacting with Tekton.

Migration Steps with Tekton:

  1. Install Tekton: Deploy the Tekton Pipelines and Tekton Triggers CRDs to your Kubernetes cluster.
  2. Translate Rancher Pipeline Definitions to Tekton Tasks: For each stage in your Rancher Pipeline (e.g., build, test, deploy), define a corresponding Tekton Task.
  3. Define Tekton Pipelines: Assemble your Tekton Tasks into Pipelines that mirror the workflow of your original Rancher Pipelines.
  4. Configure Triggers (Optional but recommended): Use Tekton Triggers to automatically start PipelineRuns based on events like Git commits or webhooks.
  5. Create PipelineRuns: Manually trigger PipelineRuns for testing or set up your triggers to automate them.
  6. Integrate with GitOps (Optional): You can have your Tekton pipelines deploy applications managed by Fleet, or vice-versa, to create a comprehensive GitOps and CI/CD workflow.

Example Tekton Task (Conceptual):

# In your Tekton definitions (e.g., tekton/tasks/build-image.yaml)
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: build-image
spec:
  params:
    - name: IMAGE_URL
      description: The URL of the image to build
    - name: GIT_REPO_URL
      description: The Git repository URL
    - name: REVISION
      description: The Git revision
  steps:
    - name: build-and-push
      image: gcr.io/cloud-builders/docker # Or your preferred build image
      script: |
        docker build -t $(params.IMAGE_URL):$(params.REVISION) .
        docker push $(params.IMAGE_URL):$(params.REVISION)

Example Tekton Pipeline (Conceptual):

# In your Tekton definitions (e.g., tekton/pipelines/app-pipeline.yaml)
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: app-pipeline
spec:
  tasks:
    - name: build-and-push-image
      taskRef:
        name: build-image
      params:
        - name: IMAGE_URL
          value: "myregistry.com/my-app"
        - name: GIT_REPO_URL
          value: $(params.gitRepositoryUrl) # Passed from PipelineRun
        - name: REVISION
          value: $(params.gitRevision) # Passed from PipelineRun
    # Add more tasks for testing, deploying, etc.

Combining Fleet and Tekton

The most robust solution often involves using both Fleet and Tekton. Fleet handles the GitOps aspect of deploying your applications and cluster configurations, ensuring that your desired state is always reflected in your clusters. Tekton handles the CI/CD aspect, building your container images and running your tests.

In this combined approach:

  • Tekton pipelines can be triggered by Git commits.
  • Tekton can build container images and push them to a registry.
  • Tekton can then update a Kubernetes manifest (e.g., a Deployment’s image tag) in your GitOps repository.
  • Fleet, monitoring the GitOps repository, will detect the change and deploy the new version of your application to your clusters.

This integration provides a powerful and automated way to manage your applications from code commit to production deployment. The next step in your journey will likely be integrating security scanning into your CI/CD pipelines.

Want structured learning?

Take the full Rancher course →