Kubernetes
Dragonfly Quick Start document aims to help you to quick start Dragonfly journey. This experiment is quite easy and simplified.
You can have a quick start following Helm Charts.
We recommend to use Containerd with CRI
and CRI-O
client.
This table describes some container runtimes version and documents.
Runtime | Version | Document | CRI Support | Pull Command |
---|---|---|---|---|
Containerd* | v1.1.0+ | Link | Yes | crictl pull docker.io/library/alpine:latest |
Containerd without CRI | v1.1.0 | Link | No | ctr image pull docker.io/library/alpine |
CRI-O | All | Link | Yes | crictl pull docker.io/library/alpine:latest |
containerd
is recommended.
Runtime Configuration Guide for Dragonfly Helm Chart
Dragonfly helm supports config docker automatically.
Config cases:
Implicit registries support
Chart customize values.yaml:
containerRuntime:
docker:
enable: true
# -- Inject domains into /etc/hosts to force redirect traffic to dfdaemon.
# Caution: This feature need dfdaemon to implement SNI Proxy,
# confirm image tag is greater than v0.4.0.
# When use certs and inject hosts in docker, no necessary to restart docker daemon.
injectHosts: true
registryDomains:
- 'harbor.example.com'
- 'harbor.example.net'
This config enables docker pulling images from registries
harbor.example.com
and harbor.example.net
via Dragonfly.
When deploying Dragonfly with above config, it's unnecessary to restart docker daemon.
Limitations:
- Only support implicit registries
Prepare Kubernetes Cluster
If there is no available Kubernetes cluster for testing,
minikube is
recommended. Just run minikube start
.
Install Dragonfly
Install with default configuration
helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/
helm install --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly
Wait Dragonfly Ready
Wait all pods running
kubectl -n dragonfly-system wait --for=condition=ready --all --timeout=10m pod
Manager Console
The console page will be displayed on
dragonfly-manager.dragonfly-system.svc.cluster.local:8080
.
If you need to bind Ingress, you can refer to configuration options of Helm Charts, or create it manually.
Console features preview reference document console preview.
Using Dragonfly
After all above steps, create a new pod with target registry.
Or just pull an image with crictl
:
crictl harbor.example.com/library/alpine:latest
crictl pull docker.io/library/alpine:latest
After pulled images, find logs in dfdaemon pod:
# find pods
kubectl -n dragonfly-system get pod -l component=dfdaemon
# find logs
pod_name=dfdaemon-xxxxx
kubectl -n dragonfly-system exec -it ${pod_name} -- grep "peer task done" /var/log/dragonfly/daemon/core.log
Example output:
{
"level": "info",
"ts": "2022-09-07 12:04:26.485",
"caller": "peer/peertask_conductor.go:1500",
"msg": "peer task done, cost: 1ms",
"peer": "10.140.2.175-5184-1eab18b6-bead-4b9f-b055-6c1120a30a33",
"task": "b423e11ddb7ab19a3c2c4c98e5ab3b1699a597e974c737bb4004edeef6016ed2",
"component": "PeerTask"
}
Preheat
To get the best out of Dragonfly, you can pull the image in advance by preheat