Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc7d9b5

Browse files
Merge pull request#282 from codefresh-io/runner-volumes-configuration
updated volume selectors and runtime cleaners
2 parents7f057d6 +504a86c commitcc7d9b5

File tree

1 file changed

+140
-16
lines changed

1 file changed

+140
-16
lines changed

‎_docs/administration/codefresh-runner.md‎

Lines changed: 140 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ You can obtain an API Key from your [user settings page](https://g.codefresh.io/
4545

4646
***Note:** access to the Codefresh CLI is only needed once during the Runner installation. After that, the Runner will authenticate on it own using the details provided. You do NOT need to install the Codefresh CLI on the cluster that is running Codefresh pipelines.*
4747

48-
Then run the wizard with the following command
48+
Then run the wizard with the following command:
4949

5050
```
5151
codefresh runner init
@@ -127,7 +127,7 @@ codefresh runner init --values values.yaml
127127

128128
You can use[this example](https://github.com/codefresh-io/venona/blob/release-1.0/venonactl/example/values-example.yaml) as a starting point for your values file.
129129

130-
###Inspecting the Manifestsbefore they areinstalled
130+
###Inspecting the ManifestsBefore they areInstalled
131131

132132
If you want to see what manifests are used by the installation wizard you can supply the`--dry-run` parameter in the installation process.
133133

@@ -217,7 +217,7 @@ runner-5d549f8bc5-7h5rc 1/1 Running 0 3
217217
```
218218
In the same manner you can list secrets, config-maps, logs, volumes etc. for the Codefresh builds.
219219
220-
## Removing the Codefreshrunner
220+
## Removing the CodefreshRunner
221221
222222
You can uninstall the Codefresh runner from your cluster by running:
223223
@@ -239,7 +239,7 @@ Like the installation wizard, you can pass the following options in advance as c
239239
| kube-config-path | Path to kubeconfig file (default is $HOME/.kube/config) |
240240
| verbose | Print logs. |
241241
242-
## Systemrequirements
242+
## SystemRequirements
243243
244244
Once installed the runner uses the following pods:
245245
@@ -271,14 +271,14 @@ Node size and count will depend entirely on how many pipelines you want to be
271271
272272
The size of your nodes directly relates to the size required for your pipelines and thus it is dynamic. If you find that only a few larger pipelines require larger nodes you may want to have two Codefresh Runners associated to different node pools.
273273
274-
### Storagespace
274+
### StorageSpace
275275
276276
For the storage space needed by the `dind` pod we suggest:
277277
278278
* [Local SSD](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/local-ssd) in the case of GCP
279279
* [EBS](https://aws.amazon.com/ebs/) in the case of Amazon. See also the [notes](#installing-on-aws) about getting caching working.
280280
281-
### Networkingrequirements
281+
### NetworkingRequirements
282282
283283
* `dind` - this pod will create an internal network in the cluster to run all the pipeline steps
284284
* `dind` needs outgoing/egress access to Dockerhub and `quay.io`
@@ -300,7 +300,7 @@ codefresh runner upgrade
300300
301301
and follow the wizard prompts.
302302
303-
## Optionalinstallation of the App Proxy
303+
## OptionalInstallation of the App Proxy
304304
305305
The App Proxy is an optional component of the runner that once installed:
306306
@@ -349,7 +349,7 @@ If you have multiple ingress controllers in the Kubernetes cluster you can use t
349349
By default the app-proxy ingress will use the path `hostname/app-proxy`. You can change that default by using the values file in the installation with the flag `--values values.yaml`. See the `AppProxy` section in the example [values.yaml](https://github.com/codefresh-io/venona/blob/release-1.0/venonactl/example/values-example.yaml).
350350
351351
352-
## Manualinstallation of Runnercomponents
352+
## ManualInstallation of RunnerComponents
353353
354354
If you don't want to use the wizard, you can also install the components of the runner yourself.
355355
@@ -370,7 +370,7 @@ codefresh install agent --agent-kube-namespace codefresh --install-runtime
370370
371371
You can then follow the instructions for [using the runner](#using-the-codefresh-runner).
372372
373-
### Installingmultiple runtimes with asingle agent
373+
### InstallingMultiple runtimes with aSingle Agent
374374
375375
It is also possible, for advanced users to install a single agent that can manage multiple runtime environments.
376376
@@ -409,11 +409,46 @@ codefresh install runtime --runtime-kube-namespace codefresh-runtime-2
409409
codefresh attach runtime --agent-name $AGENT_NAME --agent-kube-namespace codefresh-agent --runtime-name $RUNTIME_NAME --runtime-kube-namespace codefresh-runtime-2 --restart-agent
410410
```
411411
412-
## Configurationoptions
412+
## ConfigurationOptions
413413
414414
You can fine tune the installation of the runner to better match your environment and cloud provider.
415415
416-
### Custom global environment variables
416+
### Volume Reusage Policy
417+
418+
The behavior of how the volumes are reused depends on volume selector configuration.
419+
`reuseVolumeSelector` option is configurable in runtime environment spec.
420+
421+
The following options are available:
422+
423+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName'` - determined PV can be used by **ANY** pipeline of your account (it's a **default** volume selector).
424+
425+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id'` - determined PV can be used only by a **single pipeline**.
426+
427+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id,io.codefresh.branch_name'` - determined PV can be used only by **single pipeline AND single branch**.
428+
429+
- `reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id,trigger'` - determined PV can be used only by **single pipeline AND single trigger**.
430+
431+
To change volume selector follow this procedure:
432+
433+
```shell
434+
#get runtime environmet spec yaml
435+
codefresh get re $RUNTIME_NAME -o yaml > runtime.yaml
436+
```
437+
Under`dockerDaemonScheduler.pvcs.dind` block specify`reuseVolumeSelector`:
438+
{% highlight yaml %}
439+
{% raw %}
440+
pvcs:
441+
dind:
442+
volumeSize: 30Gi
443+
reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id'
444+
{% endraw %}
445+
{% endhighlight %}
446+
```shell
447+
#apply changes to runtime environment
448+
codefresh patch re -f runtime.yaml
449+
```
450+
451+
###Custom Global Environment Variables
417452

418453
You can add your own environment variables in the runtime environment, so that all pipeline steps have access to the same set of external files. A typical
419454
example would be a shared secret that you want to pass everywhere.
@@ -467,7 +502,7 @@ codefresh patch runtime-environment ivan@acme-ebs.us-west-2.eksctl.io/codefresh-
467502

468503

469504

470-
### Customvolume mounts
505+
###CustomVolume Mounts
471506

472507
You can add your own volume mounts in the runtime environment, so that all pipeline steps have access to the same set of external files. A typical
473508
example of this scenario is when you want to make a set of SSL certificates available to all your pipelines. Rather than manually
@@ -510,7 +545,7 @@ Update your runtime environment with the [patch command](https://codefresh-io.gi
510545
```
511546
codefresh patch runtime-environment ivan@acme-ebs.us-west-2.eksctl.io/codefresh-runtime -f runtime.yaml
512547
```
513-
### Internalregistry mirror
548+
###InternalRegistry Mirror
514549

515550
You can configure your Codefresh Runner to use an internal registry as a mirror for any container images that are mentioned in your pipelines.
516551

@@ -678,9 +713,9 @@ codefresh patch runtime-environment ivan@acme-ebs.us-west-2.eksctl.io/codefresh-
678713
```
679714

680715

681-
### Installing to EKS withautoscaling
716+
###Installing to EKS withAutoscaling
682717

683-
#### Step 1- EKS Clustercreation
718+
####Step 1- EKS ClusterCreation
684719

685720
See below is a content of cluster.yaml file. We define separate node pools for dind, engine and other services(like runner, cluster-autoscaler etc).
686721

@@ -1230,7 +1265,7 @@ Follow these steps to create a Codefresh user with Cluster Admin rights, from th
12301265
- Copy the Bearer Token field (combines Access Key and Secret Key)
12311266
- Edit your kubeconfig and put the Bearer Token you copied in the`token` field of your user
12321267

1233-
#### Step 3 - Install therunner
1268+
####Step 3 - Install theRunner
12341269

12351270
If you've created your kubeconfig from the Rancher UI, then it will contain an API endpoint that is not reachable internally, from within the cluster. To work around this, we need to tell the runner to instead use Kubernetes' generic internal API endpoint. Also, if you didn't create a Codefresh user in step 2 and your kubeconfig contains your personal user account, then you should also add the`--skip-cluster-integration` option.
12361271

@@ -1474,8 +1509,97 @@ For example, let's say Venona-zoneA is the default RE, then, that means that for
14741509

14751510
Regarding[Regional Persistent Disks](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/regional-pd), their support is not currently implemented in the Codefresh runner.
14761511

1512+
##Runtime Cleaners
1513+
1514+
#####Key points:
1515+
- Codefresh pipelines require disk space for:
1516+
-[Pipeline Shared Volume](https://codefresh.io/docs/docs/yaml-examples/examples/shared-volumes-between-builds/) (`/codefresh/volume`, implemented as[docker volume](https://docs.docker.com/storage/volumes/))
1517+
- Docker containers - running and stopped
1518+
- Docker images and cached layers
1519+
- To improve performance,`volume-provisioner` is able to provision previously used disk with docker images and pipeline volume from previously running builds. It improves performance by using docker cache and decreasing I/O rate.
1520+
- Least recently docker images and volumes should be cleaned to avoid out-of-space errors.
1521+
- There are several places where pipeline volume cleanup is required, so there are several kinds of cleaner.
1522+
1523+
#####Cleaners:
1524+
-[IN-DIND cleaner](https://github.com/codefresh-io/dind/tree/master/cleaner) - deletes extra docker containers, volumes, images in**dind pod**
1525+
-[External volumes cleaner](https://github.com/codefresh-io/runtime-cluster-monitor/blob/master/chart/templates/dind-volume-cleanup.yaml) - deletes unused**external** PVs (EBS, GCE/Azure disks)
1526+
-[Local volumes cleaner](https://github.com/codefresh-io/dind-volume-utils/blob/master/local-volumes/lv-cleaner.sh) - deletes**local** volumes in case node disk space is close to the threshold
1527+
1528+
***
1529+
1530+
#####IN-DIND cleaner
1531+
**Purpose:** Removes unneeded*docker containers, images, volumes* inside kubernetes volume mounted to the dind pod
1532+
1533+
**Where it runs:** Running inside each dind pod as script
1534+
1535+
**Triggered by:** SIGTERM and also during the run when disk usage (cleaner-agent ) > 90% (configurable)
1536+
1537+
**Configured by:** Environment Variables which can be set in Runtime Environment configuration
1538+
1539+
**Configuration/Logic:**[README.md](https://github.com/codefresh-io/dind/tree/master/cleaner#readme)
1540+
1541+
Override`dockerDaemonScheduler.envVars` on Runtime Environment if necessary (the following are**defaults**):
1542+
{% highlight yaml %}
1543+
{% raw %}
1544+
dockerDaemonScheduler:
1545+
envVars:
1546+
CLEAN_DOCKER: 'true'
1547+
CLEAN_PERIOD_BUILDS: '5'
1548+
IMAGE_RETAIN_PERIOD: '14400'
1549+
VOLUMES_RETAIN_PERIOD: '14400'
1550+
{% endraw %}
1551+
{% endhighlight %}
1552+
1553+
***
1554+
1555+
#####External volumes cleaner
1556+
**Purpose:** Removes unused*kubernetes volumes and related backend volumes*
1557+
1558+
**Where it runs:** On Runtime Cluster as CronJob
1559+
(`kubectl get cronjobs -n codefresh -l app=dind-volume-cleanup`). Installed in case the Runner uses non-local volumes (`Storage.Backend != local`)
1560+
1561+
**Triggered by:** CronJob every 10min (configurable), part of[runtime-cluster-monitor](https://github.com/codefresh-io/runtime-cluster-monitor/blob/master/chart/templates/dind-volume-cleanup.yaml) and runner deployment
1562+
1563+
**Configuration:**
1564+
1565+
Set`codefresh.io/volume-retention` annotation on Runtime Environment:
1566+
{% highlight yaml %}
1567+
{% raw %}
1568+
dockerDaemonScheduler:
1569+
pvcs:
1570+
dind:
1571+
storageClassName: dind-ebs-volumes-runner-codefresh
1572+
reuseVolumeSelector: 'codefresh-app,io.codefresh.accountName,pipeline_id'
1573+
volumeSize: 32Gi
1574+
annotations:
1575+
codefresh.io/volume-retention: 7d
1576+
{% endraw %}
1577+
{% endhighlight %}
1578+
1579+
Override environment variables for`dind-volume-cleanup` cronjob if necessary:
1580+
-`RETENTION_DAYS` (defaults to 4)
1581+
-`MOUNT_MIN` (defaults to 3)
1582+
-`PROVISIONED_BY` (defaults to`codefresh.io/dind-volume-provisioner`)
1583+
1584+
About*optional*`-m` argument:
1585+
-`dind-volume-cleanup` to clean volumes that were last used more than`RETENTION_DAYS` ago
1586+
-`dind-volume-cleanup-m` to clean volumes that were used more than a day ago, but mounted less than`MOUNT_MIN` times
1587+
1588+
***
1589+
1590+
#####Local volumes cleaner
1591+
**Purpose:** Deletes local volumes in case node disk space is close to the threshold
1592+
1593+
**Where it runs:** On each node on runtime cluster as DaemonSet`dind-lv-monitor`. Installed in case the Runner use local volumes (`Storage.Backend == local`)
1594+
1595+
**Triggered by:** Starts clean if disk space usage or inodes usage is more than thresholds (configurable)
14771596

1597+
**Configuration:**
14781598

1599+
Override environment variables for`dind-lv-monitor` daemonset if necessary:
1600+
-`VOLUME_PARENT_DIR` - default`/var/lib/codefresh/dind-volumes`
1601+
-`KB_USAGE_THRESHOLD` - default 80 (percentage)
1602+
-`INODE_USAGE_THRESHOLD` - default 80
14791603

14801604
##Troubleshooting
14811605

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp