Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/versioned/install/operator/configuring-serving-cr.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ location. This section is only needed when the registry images do not match the
must be created in the same namespace as the Knative Serving Deployments. See
[deploying images from a private container registry](../../serving/deploying-from-private-registry.md) for configuration details.

For a disconnected installation, see [Install in a disconnected
cluster](knative-with-operators.md#install-in-a-disconnected-cluster) for the
release image inventory and mirroring steps. If you mirror the queue proxy,
configure `spec.config.deployment.queue-sidecar-image` for the injected sidecar
and `spec.registry.override.queue-proxy` for the caching resource.

### Download images in a predefined format without secrets

This example shows how you can define custom image links that can be defined in the CR using the simplified format
Expand Down
162 changes: 162 additions & 0 deletions docs/versioned/install/operator/knative-with-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,168 @@ To track the log of the Operator, run the command:
kubectl logs -f deploy/knative-operator
```

## Install in a disconnected cluster

Prepare the installation on a machine that can reach the public registries. The
cluster needs access to an internal registry and must trust its TLS certificate.
The example below installs Knative Operator 1.24.2 with Serving 1.24.0 and Kourier.
For a different release or ingress, inventory the corresponding bundled
manifests again. Include any Eventing, optional components, or application images
that you plan to run.

### Find the source images

Download the Operator manifest from its release and the component manifests from
the same Operator tag. This identifies the images that this Operator actually
installs. A standalone ingress release can use a different digest from the
version bundled with the Operator.

```bash
OPERATOR_TAG=knative-v1.24.2
SERVING_VERSION=1.24.0
SERVING_MINOR=1.24
BUNDLE="https://raw.githubusercontent.com/knative/operator/${OPERATOR_TAG}/cmd/operator/kodata"

curl -fLo operator.yaml "https://github.com/knative/operator/releases/download/${OPERATOR_TAG}/operator.yaml"
curl -fLo serving-core.yaml "${BUNDLE}/knative-serving/${SERVING_VERSION}/2-serving-core.yaml"
curl -fLo serving-hpa.yaml "${BUNDLE}/knative-serving/${SERVING_VERSION}/3-serving-hpa.yaml"
curl -fLo serving-jobs.yaml "${BUNDLE}/knative-serving/${SERVING_VERSION}/4-serving-post-install-jobs.yaml"
curl -fLo kourier.yaml "${BUNDLE}/ingress/${SERVING_MINOR}/kourier/kourier.yaml"
```

Use [yq v4](https://github.com/mikefarah/yq) to print the workload/container
keys and their exact upstream image references. The queue proxy also appears in
`config-deployment`, which controls the sidecar injected into Serving Revisions.

```bash
yq --no-doc -r '
select(.kind == "Deployment" or .kind == "Job") |
(.metadata.generateName // .metadata.name) as $workload |
.spec.template.spec.containers[] |
[($workload + "/" + .name), .image] | @tsv
' operator.yaml serving-core.yaml serving-hpa.yaml serving-jobs.yaml kourier.yaml | awk NF

yq eval-all --no-doc -r '
select(.kind == "ConfigMap" and .metadata.name == "config-deployment") |
.data."queue-sidecar-image"
' serving-core.yaml
```

| Workload/container key or setting | Repository in the mirror |
| --- | --- |
| `knative-operator/knative-operator` | `operator` |
| `operator-webhook/operator-webhook` | `operator-webhook` |
| `activator/activator` | `serving-activator` |
| `autoscaler/autoscaler` | `serving-autoscaler` |
| `controller/controller` | `serving-controller` |
| `webhook/webhook` | `serving-webhook` |
| `autoscaler-hpa/autoscaler-hpa` | `serving-autoscaler-hpa` |
| `storage-version-migration-serving-/migrate` | `serving-migrate` |
| `cleanup-serving-/cleanup` | `serving-cleanup` |
| `net-kourier-controller/controller` | `kourier-controller` |
| `3scale-kourier-gateway/kourier-gateway` | `kourier-gateway` |
| `config-deployment` → `queue-sidecar-image` | `serving-queue` |

### Transfer the images

Use [Skopeo](https://github.com/podman-container-tools/skopeo) to copy each
source reference to a separate OCI archive named for its mirror repository.
`--all` includes every platform in a multi-architecture image. For example, to
export the Operator image from the downloaded manifest:

```bash
SOURCE=$(yq eval-all --no-doc -r '
select(.kind == "Deployment" and .metadata.name == "knative-operator") |
.spec.template.spec.containers[] | select(.name == "knative-operator") | .image
' operator.yaml)
skopeo copy --all "docker://${SOURCE}" oci-archive:operator.tar
```

Transfer the archives and `operator.yaml` to a dedicated directory in the
disconnected environment. Authenticate to the internal registry using `skopeo login` if needed. Copy each
archive into the corresponding repository. The example uses the local tag
`operator-v1.24.2` for all mirror entries, including the bundled components.

```bash
(
set -e
for archive in ./*.tar; do
mirror_name=${archive##*/}
mirror_name=${mirror_name%.tar}
skopeo copy --all "oci-archive:${archive}" \
"docker://registry.example.com/knative/${mirror_name}:operator-v1.24.2"
done
)
```

### Configure the Operator and Serving

In `operator.yaml`, set the two Deployment images to the mirrored `operator`
and `operator-webhook` references from the table. If the registry requires
credentials, create the `knative-operator` namespace and a registry Secret in
it before installing. Reference that Secret in each Deployment's
`spec.template.spec.imagePullSecrets`. Apply the edited local manifest and wait
for both Deployments:

```bash
kubectl apply -f operator.yaml
kubectl -n knative-operator rollout status deployment/knative-operator
kubectl -n knative-operator rollout status deployment/operator-webhook
```

Create the `knative-serving` namespace and, if needed, a registry Secret named
`mirror-credentials` in that namespace. Apply a `KnativeServing` resource with
these settings. Omit `imagePullSecrets` if nodes can already pull from the
mirror. Keep both queue proxy settings so that the caching resource and
injected sidecar use the same image.

```yaml
apiVersion: operator.knative.dev/v1beta1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
version: "1.24.0"
ingress:
kourier:
enabled: true
config:
network:
ingress-class: kourier.ingress.networking.knative.dev
deployment:
queue-sidecar-image: registry.example.com/knative/serving-queue:operator-v1.24.2
registry:
imagePullSecrets:
- name: mirror-credentials
override:
activator/activator: registry.example.com/knative/serving-activator:operator-v1.24.2
autoscaler/autoscaler: registry.example.com/knative/serving-autoscaler:operator-v1.24.2
controller/controller: registry.example.com/knative/serving-controller:operator-v1.24.2
webhook/webhook: registry.example.com/knative/serving-webhook:operator-v1.24.2
autoscaler-hpa/autoscaler-hpa: registry.example.com/knative/serving-autoscaler-hpa:operator-v1.24.2
storage-version-migration-serving-/migrate: registry.example.com/knative/serving-migrate:operator-v1.24.2
cleanup-serving-/cleanup: registry.example.com/knative/serving-cleanup:operator-v1.24.2
net-kourier-controller/controller: registry.example.com/knative/kourier-controller:operator-v1.24.2
3scale-kourier-gateway/kourier-gateway: registry.example.com/knative/kourier-gateway:operator-v1.24.2
queue-proxy: registry.example.com/knative/serving-queue:operator-v1.24.2
```

Save the resource as `knative-serving.yaml`. Apply it and check the Serving
status and image references in the system namespace:

```bash
kubectl apply -f knative-serving.yaml
kubectl -n knative-serving wait knativeserving/knative-serving --for=condition=Ready --timeout=300s
kubectl -n knative-serving get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}'
kubectl -n knative-serving get configmap config-deployment -o jsonpath='{.data.queue-sidecar-image}{"\n"}'
```

The CR's registry Secret applies to the managed Knative resources. For a
Revision in an application namespace, configure pull credentials on the Service
or its ServiceAccount. See [Deploying images from a private container
registry](../../serving/deploying-from-private-registry.md).

## Install Knative Serving

To install Knative Serving you must create a custom resource (CR), add a networking layer to the CR, and configure DNS.
Expand Down