# Kubernetes mirror (pkg.shecan.ir)

> Pull-through mirror of registry.k8s.io.

- Upstream: registry.k8s.io
- Mirror URL: <https://mirror-k8s.pkg.shecan.ir/>
- Clients: docker, podman, containerd, skopeo
- Service status: <https://pkg.shecan.ir/status.json> (key `k8s`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/k8s/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/k8s.json>

## Limitations

- Pull only: no docker login is needed and push is disabled.
- Write mirror-k8s.pkg.shecan.ir instead of registry.k8s.io in image names; the rest of the name is unchanged.
- containerd reads hosts.toml only when its registry config_path is /etc/containerd/certs.d.
- kubectl, kubeadm, kubelet (pkgs.k8s.io, dl.k8s.io) and Helm come from the separate kubernetes mirror (mirror-kubernetes.pkg.shecan.ir).

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### docker, podman: temporary (one command or the current shell; nothing saved)

Run

```sh
docker pull mirror-k8s.pkg.shecan.ir/pause:3.10
```

### containerd: persistent (user- or system-wide configuration)

Configuration file (linux): `/etc/containerd/certs.d/registry.k8s.io/hosts.toml`

```toml
server = "https://registry.k8s.io"
[host."https://mirror-k8s.pkg.shecan.ir"]
  capabilities = ["pull", "resolve"]
```

Undo / restore the default (linux)

```sh
sudo rm /etc/containerd/certs.d/registry.k8s.io/hosts.toml
```

### podman, skopeo: persistent (user- or system-wide configuration)

Configuration file (linux): `/etc/containers/registries.conf`

```toml
[[registry]]
prefix = "registry.k8s.io"
location = "registry.k8s.io"

[[registry.mirror]]
location = "mirror-k8s.pkg.shecan.ir"
```

Undo / restore the default (linux)

```sh
sudo sed -i '/^\[\[registry\]\]$/{N;/\nprefix = "registry.k8s.io"$/{N;N;N;N;d}}' /etc/containers/registries.conf
```
