# Deploy & Track

---

## Overview

Deploy releases to your environments and track what's running, right from your coding agent or your existing CD pipeline.

Once your environments are connected to Fly:

- **Every deployment is tracked automatically**. Every image pull is recorded, so you always know what's running where
- **Know what's running in every environment** at any time. Ask your coding agent or check Fly Web
- **Find if a fix is live**. Ask "is PR #278 deployed to production?" and get an answer
- **Compare environments side by side**. See which releases are in sync, which fixes exist in one but not the other
- **Works with your existing CD pipeline**. Argo, Flux, kubectl, or any tool that pulls images. Once connected, Fly tracks it all

For a deep dive into how environments work, see [Runtime Environments →](../../fly-platform/runtime-environments/).

---

## Set Up an Environment

### 1. Create an Environment

Ask your coding agent:

*"Create a staging environment"*

Or create one from Fly Web. Provide a **name** (lowercase, numbers, hyphens) and an optional description.

### 2. Connect to Kubernetes

Ask your coding agent:

*"Set up my K8s to work with Fly"*

Fly generates a token, associates it with your environment, and gives you the commands to apply. You can also generate tokens from Fly Web.

**Create the image pull secret:**

```bash
kubectl create secret docker-registry fly-registry-secret \
  --docker-server=<your-fly-subdomain>.jfrog.io/docker \
  --docker-username=<token-username> \
  --docker-password=<your-token> \
  --namespace=<namespace>
```

**Reference it in your deployment:**

```yaml
spec:
  template:
    spec:
      imagePullSecrets:
        - name: fly-registry-secret
      containers:
        - name: my-app
          image: <your-fly-subdomain>.jfrog.io/docker/<image-name>:<tag>
```

Once connected, Fly tracks every image pull automatically.

---

## Deploy Releases

### Use Your Coding Agent

Describe what you want to deploy in natural language:

*"Deploy the login fix to staging"*

*"Deploy payment-service v2.3.1 to production"*

*"Find the release where I fixed the auth bug and deploy it"*

Fly searches your releases semantically, finds the right image, and deploys it to the target environment. Credentials and tracking are handled automatically.

### Use Your CD Pipeline

If you already have a deployment pipeline (Argo CD, Flux, kubectl apply, or any tool that pulls images), it works once the image pull secret is in place. Your pipeline pulls images from Fly Registry like any other registry:

```bash
kubectl set image deployment/my-app \
  my-app=<your-fly-subdomain>.jfrog.io/docker/my-app:v2.3.1
```

Fly tracks every pull automatically. Your deployments show up in the environment dashboard with full release context.

---

## Track Your Runtime

Once your environments are connected, ask Fly about your runtime directly from your coding agent or Fly Chat.

| Question | Ask Fly | What you see |
|----------|---------|--------------|
| **What's running?** | *"What's running in production?"* | Active image, release summary, PRs, commits, and full deployment history |
| **Is my fix live?** | *"Is the fix for the login timeout deployed to production?"* | Whether the fix exists in the current release or recent history |
| **Is my environment up to date?** | *"Is staging up to date?"* | Comparison against the latest release, with missing releases listed |
| **How do environments compare?** | *"Compare staging vs production"* | Side-by-side: releases in sync, PRs in one but not the other, version gap |
| **What changed?** | *"What changed recently in my registration service?"* | Chronological deployment log with release summaries, PRs, commits, and timestamps |

---

## Next Steps

- [Runtime Environments →](../../fly-platform/runtime-environments/) - Full platform reference for environments
- [Tokens →](../../fly-platform/tokens/) - Token types and management
- [Releases →](../../fly-platform/releases/) - Understanding releases
