Skip to content

Commit

Permalink
Merge pull request #319 from ktock/stargz-store-doc
Browse files Browse the repository at this point in the history
Add doc about installing stargz store
  • Loading branch information
AkihiroSuda authored May 12, 2021
2 parents 02bf457 + c08c12f commit 79d4281
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 14 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Stargz Snapshotter is a **non-core** sub-project of containerd.
## Quick Start with Kubernetes

- For more details about stargz snapshotter plugin and its configuration, refer to [Containerd Stargz Snapshotter Plugin Overview](/docs/overview.md).
- For more details about setup lazy pulling of eStargz with containerd, CRI-O, Podman, systemd, etc., refer to [Install Stargz Snapshotter and Stargz Store](./docs/INSTALL.md).

For using stargz snapshotter on kubernetes nodes, you need the following configuration to containerd as well as run stargz snapshotter daemon on the node.
We assume that you are using containerd (> v1.4.2) as a CRI runtime.
Expand Down Expand Up @@ -110,8 +111,6 @@ Hello World!

Stargz snapshotter also supports [further configuration](/docs/overview.md) including private registry authentication, mirror registries, etc.

- For more details about installing Stargz Snapshotter, refer to [Install Stargz Snapshotter](./docs/INSTALL.md).

## Creating eStargz images with optimization

- For more examples and details about the image converter `ctr-remote`, refer to [Optimize Images with `ctr-remote image optimize`](/docs/ctr-remote.md).
Expand Down
5 changes: 3 additions & 2 deletions cmd/stargz-store/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ import (

const (
defaultLogLevel = logrus.InfoLevel
defaultConfigPath = "/etc/stargz-store/config.toml"
defaultRootDir = "/var/lib/stargz-store"
defaultMaxConcurrency = 2
)

var (
configPath = flag.String("config", "", "path to the configuration file")
configPath = flag.String("config", defaultConfigPath, "path to the configuration file")
logLevel = flag.String("log-level", defaultLogLevel.String(), "set the logging level [trace, debug, info, warn, error, fatal, panic]")
rootDir = flag.String("root", defaultRootDir, "path to the root directory for this snapshotter")
)
Expand Down Expand Up @@ -88,7 +89,7 @@ func main() {

// Get configuration from specified file
if *configPath != "" {
if _, err := toml.DecodeFile(*configPath, &config); err != nil {
if _, err := toml.DecodeFile(*configPath, &config); err != nil && !(os.IsNotExist(err) && *configPath == defaultConfigPath) {
log.G(ctx).WithError(err).Fatalf("failed to load config file %q", *configPath)
}
}
Expand Down
90 changes: 80 additions & 10 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
# Install Stargz Snapshotter
# Install Stargz Snapshotter and Stargz Store

We assume that you are using containerd (> v1.4.2) as a CRI runtime.
## What's Stargz Snapshotter and Stargz Store?

*Stargz Snapshotter* is a plugin for containerd, which enables it to perform lazy pulling of eStargz.
This is an implementation of *remote snapshotter* plugin and provides remotely-mounted eStargz layers to containerd.
Communication between containerd and Stargz Snapshotter is done with gRPC over unix socket.
For more details about Stargz Snapshotter and the relationship with containerd, [please refer to the doc](./overview.md).

If you are using CRI-O/Podman, you can't use Stargz Snapshotter for enabling lazy pulling of eStargz.
Instead, use *Stargz Store* plugin.
This is an implementation of *additional layer store* plugin of CRI-O/Podman.
Stargz Store provides remotely-mounted eStargz layers to CRI-O/Podman.

Stargz Store exposes mounted filesystem structured like the following.
CRI-O/Podman access to this filesystem to acquire eStargz layers.

```
<mountpoint>/base64(imageref)/<layerdigest>/
- diff : exposes the extracted eStargz layer
- info : contains JSON-formatted metadata of this layer
- use : files to notify the use of this layer (used for GC)
```

## Install Stargz Snapshotter with Systemd
## Install Stargz Snapshotter for containerd with Systemd

To enable lazy pulling of eStargz on containerd, you need to install *Stargz Snapshotter* plugin.
This section shows the step to install Stargz Snapshotter with systemd.
We assume that you are using containerd (> v1.4.2) as a CRI runtime.

- Download release tarball from [the release page](https://github.com/containerd/stargz-snapshotter/releases). For example, amd64 binary of v0.5.0 is available from https://github.com/containerd/stargz-snapshotter/releases/download/v0.5.0/stargz-snapshotter-v0.5.0-linux-amd64.tar.gz.

- Add the following configuration to containerd's configuration file (typically: /etc/containerd/config.toml). Please see also [an example configuration file](../script/config/etc/containerd/config.toml).
```
```toml
version = 2

# Enable stargz snapshotter for CRI
Expand Down Expand Up @@ -43,9 +67,55 @@ We assume that you are using containerd (> v1.4.2) as a CRI runtime.
```

- Start stargz-snapshotter and restart containerd
```
tar -xvf stargz-snapshotter-${version}-linux-${arch}.tar.gz -C /usr/local/bin
wget -O /etc/systemd/system/stargz-snapshotter.service https://raw.githubusercontent.com/containerd/stargz-snapshotter/master/script/config/etc/systemd/system/stargz-snapshotter.service
systemctl enable --now stargz-snapshotter
systemctl restart containerd
```
```
tar -xvf stargz-snapshotter-${version}-linux-${arch}.tar.gz containerd-stargz-grpc ctr-remote -C /usr/local/bin
wget -O /etc/systemd/system/stargz-snapshotter.service https://raw.githubusercontent.com/containerd/stargz-snapshotter/master/script/config/etc/systemd/system/stargz-snapshotter.service
systemctl enable --now stargz-snapshotter
systemctl restart containerd
```

## Install Stargz Store for CRI-O/Podman with Systemd

To enable lazy pulling of eStargz on CRI-O/Podman, you need to install *Stargz Store* plugin.
This section shows the step to install Stargz Store with systemd.
We assume that you are using CRI-O newer than https://github.com/cri-o/cri-o/pull/4850 or Podman newer than https://github.com/containers/podman/pull/10214 .

- Download release tarball from [the release page](https://github.com/containerd/stargz-snapshotter/releases).

- Add the following configuration to the storage configuration file of CRI-O/Podman (typically: /etc/containers/storage.conf). Please see also [an example configuration file](../script/config-cri-o/etc/containers/storage.conf).
```toml
[storage]
driver = "overlay"
graphroot = "/var/lib/containers/storage"
runroot = "/run/containers/storage"

[storage.options]
additionallayerstores = ["/var/lib/stargz-store/store:ref"]
```

- Install fuse

###### centos
```
# centos 7
yum install fuse
# centos 8
dnf install fuse
modprobe fuse
```

###### ubuntu

```
apt-get install fuse
modprobe fuse
```

- Start stargz-store (CRI-O also needs to be restarted if you are using)
```
tar -xvf stargz-snapshotter-${version}-linux-${arch}.tar.gz stargz-store -C /usr/local/bin
wget -O /etc/systemd/system/stargz-store.service https://raw.githubusercontent.com/containerd/stargz-snapshotter/master/script/config-cri-o/etc/systemd/system/stargz-store.service
systemctl enable --now stargz-store
systemctl restart cri-o # if you are using CRI-O
```

0 comments on commit 79d4281

Please sign in to comment.