---
title: "Publishing to Edge"
linkTitle: "Publishing"
weight: 50
description: >
  How documentation is deployed to the edge environment.
---

## Deployment Overview

After successful CI/CD, the documentation is deployed to an edge computing environment.

{{< likec4-view view="deploymentFlow" project="documentation-platform" >}}

## Deployment Architecture

### Edge Connect Platform

Our documentation is deployed using **Edge Connect**, which orchestrates deployments to edge cloudlets.

Configuration: `edgeconnectdeployment.yaml`

```yaml
kind: edgeconnect-deployment
metadata:
  name: "edpdoc"
  appVersion: "1.0.0"
  organization: "edp2"
spec:
  k8sApp:
    manifestFile: "./k8s-deployment.yaml"
  infraTemplate:
    - region: "EU"
      cloudletOrg: "TelekomOP"
      cloudletName: "Munich"
      flavorName: "EU.small"
```

**Key settings:**

- **Deployment name:** `edpdoc`
- **Region:** EU (Munich)
- **Cloudlet:** TelekomOP Munich
- **Flavor:** EU.small (resource allocation)

### Kubernetes Deployment

The application runs on Kubernetes: `k8s-deployment.yaml`

#### Service Definition

```yaml
apiVersion: v1
kind: Service
metadata:
  name: edpdoc
  labels:
    run: edpdoc
spec:
  type: LoadBalancer
  ports:
    - name: tcp80
      protocol: TCP
      port: 80
      targetPort: 80
  selector:
    run: edpdoc
```

- **Type:** LoadBalancer (external access)
- **Port:** 80 (HTTP)
- **Selector:** Routes traffic to pods with label `run: edpdoc`

#### Deployment Configuration

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: edpdoc
spec:
  replicas: 1
  selector:
    matchLabels:
      run: edpdoc
  template:
    metadata:
      labels:
        run: edpdoc
        mexDeployGen: kubernetes-basic
    spec:
      containers:
        - name: edpdoc
          image: ###IMAGETAG###
          imagePullPolicy: Always
          ports:
            - containerPort: 80
              protocol: TCP
```

- **Replicas:** 1 (single instance)
- **Image:** Injected by deployment pipeline (`###IMAGETAG###` placeholder)
- **Pull policy:** Always (ensures latest version)

### Network Configuration

Outbound connections are configured in `edgeconnectdeployment.yaml`:

```yaml
network:
  outboundConnections:
    - protocol: "tcp"
      portRangeMin: 80
      portRangeMax: 80
      remoteCIDR: "0.0.0.0/0"
    - protocol: "tcp"
      portRangeMin: 443
      portRangeMax: 443
      remoteCIDR: "0.0.0.0/0"
```

- **Port 80:** HTTP outbound
- **Port 443:** HTTPS outbound
- **CIDR:** `0.0.0.0/0` (all destinations)

## Deployment Process

### 1. Container Image Ready

After CI passes:

- Docker image built with `task build:oci-image`
- Tagged with git commit SHA
- Pushed to container registry

### 2. Edge Connect Orchestration

Edge Connect:

1. Pulls container image
2. Reads `edgeconnectdeployment.yaml`
3. Provisions resources on Munich cloudlet
4. Applies Kubernetes manifests

### 3. Kubernetes Deployment

Kubernetes:

1. Creates deployment with 1 replica
2. Pulls container image (`imagePullPolicy: Always`)
3. Starts pod running Nginx + static Hugo site
4. Creates LoadBalancer service
5. Assigns external IP

### 4. Service Available

Documentation is now accessible:

- **Protocol:** HTTP
- **Port:** 80
- **IP:** Assigned by LoadBalancer

## Complete Workflow

{{< likec4-view view="fullWorkflow" project="documentation-platform" >}}

### End-to-End Process

1. **Technical Writer writes content** (Markdown, LikeC4 models)
2. **Local testing** with `task serve` and `task test`
3. **Commit and push** to Git repository
4. **GitHub Actions triggered** on push to main
5. **CI tests run** (build, markdown, HTML, links)
6. **Container image built** if tests pass
7. **Image pushed** to registry
8. **Edge deployment triggered**
9. **Kubernetes applies** manifests
10. **Service available** on edge cloudlet

## Monitoring Deployment

### Check Deployment Status

```bash
kubectl get deployments -n <namespace>
kubectl get pods -n <namespace>
kubectl get services -n <namespace>
```

### View Logs

```bash
kubectl logs deployment/edpdoc -n <namespace>
```

### Access Documentation

Find the LoadBalancer external IP:

```bash
kubectl get service edpdoc -n <namespace>
```

Access via: `http://<EXTERNAL-IP>`

## Rollback

If issues occur after deployment:

### Option 1: Revert Commit

```bash
git revert <bad-commit>
git push origin main
```

CI will rebuild and redeploy.

### Option 2: Manual Rollback

```bash
kubectl rollout undo deployment/edpdoc -n <namespace>
```

Returns to previous deployment version.

### Option 3: Deploy Specific Version

Update image tag in deployment:

```bash
kubectl set image deployment/edpdoc edpdoc=<registry>/<image>:<tag> -n <namespace>
```

## Scaling

Currently: **1 replica**

To scale for higher traffic:

```yaml
spec:
  replicas: 3
```

Then apply:

```bash
kubectl apply -f k8s-deployment.yaml
```

Or scale dynamically:

```bash
kubectl scale deployment/edpdoc --replicas=3 -n <namespace>
```

## Security Considerations

1. **Image scanning** - Scan container images for vulnerabilities
2. **Resource limits** - Set CPU/memory limits in deployment
3. **Network policies** - Restrict pod-to-pod communication
4. **HTTPS** - Consider adding TLS termination (Ingress)

## Performance Optimization

1. **CDN** - Add CDN in front of LoadBalancer
2. **Caching** - Configure Nginx caching headers
3. **Compression** - Enable gzip in Nginx
4. **Image optimization** - Compress images in documentation

## Troubleshooting

### Pod not starting

```bash
kubectl describe pod <pod-name> -n <namespace>
```

Check:

- Image pull errors
- Resource constraints
- Configuration errors

### Service unreachable

```bash
kubectl describe service edpdoc -n <namespace>
```

Check:

- LoadBalancer IP assigned
- Port configuration
- Network policies

### Old content served

Check:

- `imagePullPolicy: Always` in deployment
- Image tag is updated
- Pod has restarted

Force pod restart:

```bash
kubectl rollout restart deployment/edpdoc -n <namespace>
```

## Best Practices

1. **Test before deploying** - Always run `task test` locally
2. **Use feature branches** - Don't deploy directly from local
3. **Monitor after deployment** - Check logs and access
4. **Document changes** - Update RELEASE.md
5. **Version control** - Tag releases in Git

## Future Enhancements

Potential improvements:

- **Blue-green deployment** - Zero-downtime updates
- **Canary releases** - Gradual rollout to subset of users
- **Auto-scaling** - HorizontalPodAutoscaler based on traffic
- **Multi-region** - Deploy to multiple cloudlets
- **HTTPS** - TLS certificates and Ingress controller

## Summary

The deployment process is automated and reliable:

✅ **CI ensures quality** - Tests prevent broken deployments
✅ **Edge infrastructure** - Low-latency access from EU
✅ **Kubernetes orchestration** - Reliable, scalable platform
✅ **Simple rollback** - Easy to recover from issues

As a technicalWriter, focus on content quality. The platform handles deployment automatically! 🚀
