-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35a75fc
commit 9401104
Showing
18 changed files
with
285 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
source/kubernetes/kubeflow/install_kubeflow_single_command/authservice-pvc.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
annotations: | ||
kubectl.kubernetes.io/last-applied-configuration: | | ||
{"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"authservice-pvc","namespace":"istio-system"},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}}} | ||
creationTimestamp: "2023-08-30T14:46:40Z" | ||
finalizers: | ||
- kubernetes.io/pvc-protection | ||
name: authservice-pvc | ||
namespace: istio-system | ||
resourceVersion: "13270831" | ||
uid: 425e321b-20cd-44b4-a797-28f092bfc42a | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
volumeMode: Filesystem | ||
status: | ||
phase: Pending |
48 changes: 48 additions & 0 deletions
48
source/kubernetes/kubeflow/install_kubeflow_single_command/oidc-authservice_pending.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Name: oidc-authservice-0 | ||
Namespace: istio-system | ||
Priority: 0 | ||
Service Account: authservice | ||
Node: <none> | ||
Labels: app=authservice | ||
controller-revision-hash=oidc-authservice-7bd6b4b965 | ||
statefulset.kubernetes.io/pod-name=oidc-authservice-0 | ||
Annotations: sidecar.istio.io/inject: false | ||
Status: Pending | ||
IP: | ||
IPs: <none> | ||
Controlled By: StatefulSet/oidc-authservice | ||
Containers: | ||
authservice: | ||
Image: gcr.io/arrikto/kubeflow/oidc-authservice:e236439 | ||
Port: 8080/TCP | ||
Host Port: 0/TCP | ||
Readiness: http-get http://:8081/ delay=0s timeout=1s period=10s #success=1 #failure=3 | ||
Environment Variables from: | ||
oidc-authservice-client Secret Optional: false | ||
oidc-authservice-parameters ConfigMap Optional: false | ||
Environment: <none> | ||
Mounts: | ||
/var/lib/authservice from data (rw) | ||
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-khhmb (ro) | ||
Conditions: | ||
Type Status | ||
PodScheduled False | ||
Volumes: | ||
data: | ||
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) | ||
ClaimName: authservice-pvc | ||
ReadOnly: false | ||
kube-api-access-khhmb: | ||
Type: Projected (a volume that contains injected data from multiple sources) | ||
TokenExpirationSeconds: 3607 | ||
ConfigMapName: kube-root-ca.crt | ||
ConfigMapOptional: <nil> | ||
DownwardAPI: true | ||
QoS Class: BestEffort | ||
Node-Selectors: <none> | ||
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s | ||
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s | ||
Events: | ||
Type Reason Age From Message | ||
---- ------ ---- ---- ------- | ||
Warning FailedScheduling 3m30s (x48 over 4h1m) default-scheduler 0/5 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/5 nodes are available: 5 No preemption victims found for incoming pod.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
source/linux/storage/filesystem/linux_filename_max_length.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.. _linux_filename_max_length: | ||
|
||
========================= | ||
Linux文件名最大长度 | ||
========================= | ||
|
||
在生产环境中,总会遇到奇奇怪怪的问题。今天,一个异常长度的文件名导致脚本执行错误,引起我的好奇心,所以记录下Linux文件名最大长度。简单(简化)来说总结如下: | ||
|
||
- 文件名的最大长度通常是 ``255`` 个字节(字符)(大多数操作系统都是这样) | ||
- 文件名加路径组合起来最大长度是 ``4096`` 个字节 | ||
- 当使用归档和查询操作(我理解为 ``tar`` )最大文件名加路径组合是 ``1024`` 个字节 | ||
|
||
如果你有疑问,可以参考 `wikipedia: Comparison_of_file_systems#Limits <https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits>`_ | ||
|
||
参考 | ||
====== | ||
|
||
- `Filename length limits on linux? <https://serverfault.com/questions/9546/filename-length-limits-on-linux>`_ | ||
- `File specification syntax <https://www.ibm.com/docs/en/spectrum-protect/8.1.9?topic=parameters-file-specification-syntax>`_ | ||
- `Limit on File Name Length in Bash <https://www.baeldung.com/linux/bash-filename-limit>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
.. _zfs_startup_zcloud: | ||
|
||
=================== | ||
ZFS快速起步(zcloud) | ||
=================== | ||
|
||
:ref:`zfs_startup` 是我在 :ref:`docker_zfs_driver` 基础上完成的进一步卷管理。不算完整操作。 | ||
|
||
现在为了 :ref:`install_kubeflow_single_command` 准备 :ref:`zfs_nfs` ,则是完整的 :ref:`hpe_dl360_gen9` 服务器独立磁盘操作,记录如下 | ||
|
||
- 在ZFS操作前检查磁盘 ``fdisk -l`` 可以看到磁盘是一个dos分区表,但没有分区(买来时候) : | ||
|
||
.. literalinclude:: zfs_startup_zcloud/fdisk_before_zfs | ||
:caption: 在ZFS之前的磁盘是一个dos分区表 | ||
:emphasize-lines: 6 | ||
|
||
- 在独立磁盘 ``/dev/sda`` (这个根据操作系统启动时识别磁盘获得,每个系统可能不同)创建zpool: | ||
|
||
.. literalinclude:: zfs_startup_zcloud/zpool_create | ||
:caption: 在磁盘 ``sda`` 上创建ZFS的存储池,名字为 ``zpool-data`` | ||
|
||
- 检查 ``zpool`` : | ||
|
||
.. literalinclude:: zfs_startup_zcloud/zpool_list | ||
:caption: 使用 ``zpool list`` 检查现有的zpool存储池 | ||
|
||
可以看到输出是一个完整磁盘: | ||
|
||
.. literalinclude:: zfs_startup_zcloud/zpool_list_output | ||
:caption: 使用 ``zpool list`` 检查现有的zpool存储池 可以看到刚创建的 ``zpool-data`` | ||
|
||
- 注意,对于完整磁盘使用,ZFS会立即自动创建 ``GPT`` 分区表(抹掉之前的dos分区表),并且划分为两个分区以及做好类型标注,一切都是自动化的: 使用 ``fdisk -l`` 可以看到如下新的磁盘分区: | ||
|
||
.. literalinclude:: zfs_startup_zcloud/fdisk_zfs | ||
:caption: zpool命令在完整磁盘上创建存储池的之后,就可以看到GPT分区以及2个ZFS分区 | ||
:emphasize-lines: 10,11 | ||
|
||
待续... | ||
|
||
- 准备在 ``zpool-data`` 下构建一个 ``home`` 卷,挂载到 ``/home`` 目录,这样大多数数据都能够得到有效保存 | ||
|
||
- 首先以 ``root`` 身份登陆,并确保 ``/home`` 目录没有用户访问,将 ``/home`` 目录重命名: | ||
|
||
.. literalinclude:: zfs_startup/rename_home | ||
:language: bash | ||
:caption: 将/home目录重命名(备份) | ||
|
||
- 由于 ``zpool-data`` 存储池已经在 :ref:`mobile_cloud_x86_zfs` 构建好,所以忽略创建 ZFS 存储池步骤,直接创建卷 ``home`` ,并且创建 ``home`` 卷下面的子(用户目录): | ||
|
||
.. literalinclude:: zfs_startup/zfs_create_volume | ||
:language: bash | ||
:caption: 创建 zpool-data 存储池的 home 卷 | ||
|
||
对于存储池下创建的 ``根`` 卷,需要指定挂载目录;对于 ``根`` 卷下的子卷,可以不指定挂载目录,则会自动按照层次结构进行独立卷挂载,非常巧妙的管理模式 | ||
|
||
- 完成后使用 ``df -h`` 检查可以看到当前ZFS存储挂载目录: | ||
|
||
.. literalinclude:: zfs_startup/zfs_df_hierarchy | ||
:language: bash | ||
:caption: 创建 zpool-data 存储池的 home 卷以及子卷的挂载情况 | ||
|
||
- 卷和子卷会从上一级ZFS继承属性,由于在 :ref:`mobile_cloud_x86_zfs` 已经配置了 ``zpool-data`` 压缩属性,所以使用 ``zfs get compression`` 可以看到卷和子卷都继承了压缩属性:: | ||
|
||
# zfs get compression zpool-data/home | ||
NAME PROPERTY VALUE SOURCE | ||
zpool-data/home compression lz4 inherited from zpool-data | ||
# zfs get compression zpool-data/home/huatai | ||
NAME PROPERTY VALUE SOURCE | ||
zpool-data/home/huatai compression lz4 inherited from zpool-data | ||
|
||
- 可以设置卷的quota,例如:: | ||
|
||
zfs set quota=10G zpool-data/home/huatai | ||
|
||
- 恢复 ``/home/huatai`` 目录数据: | ||
|
||
.. literalinclude:: zfs_startup/restore_home_huatai | ||
:language: bash | ||
:caption: 恢复/home/huatai目录数据 | ||
|
||
参考 | ||
====== | ||
|
||
- `Oracle Solaris ZFS Administration Guide > Chapter 2 Getting Started With Oracle Solaris ZFS <https://docs.oracle.com/cd/E19253-01/819-5461/setup-1/index.html>`_ |
7 changes: 7 additions & 0 deletions
7
source/linux/storage/zfs/admin/zfs_startup_zcloud/fdisk_before_zfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Disk /dev/sda: 1.75 TiB, 1920383410176 bytes, 3750748848 sectors | ||
Disk model: SDLF1CRR-019T-1H | ||
Units: sectors of 1 * 512 = 512 bytes | ||
Sector size (logical/physical): 512 bytes / 4096 bytes | ||
I/O size (minimum/optimal): 4096 bytes / 4096 bytes | ||
Disklabel type: dos | ||
Disk identifier: 0x33b32403 |
11 changes: 11 additions & 0 deletions
11
source/linux/storage/zfs/admin/zfs_startup_zcloud/fdisk_zfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Disk /dev/sda: 1.75 TiB, 1920383410176 bytes, 3750748848 sectors | ||
Disk model: SDLF1CRR-019T-1H | ||
Units: sectors of 1 * 512 = 512 bytes | ||
Sector size (logical/physical): 512 bytes / 4096 bytes | ||
I/O size (minimum/optimal): 4096 bytes / 4096 bytes | ||
Disklabel type: gpt | ||
Disk identifier: CB3CD2A0-1D00-D346-B9DA-8ED7E2EEEC89 | ||
|
||
Device Start End Sectors Size Type | ||
/dev/sda1 2048 3750731775 3750729728 1.7T Solaris /usr & Apple ZFS | ||
/dev/sda9 3750731776 3750748159 16384 8M Solaris reserved 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
zpool create zpool-data sda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
zpool list |
2 changes: 2 additions & 0 deletions
2
source/linux/storage/zfs/admin/zfs_startup_zcloud/zpool_list_output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT | ||
zpool-data 1.73T 456K 1.73T - - 0% 0% 1.00x ONLINE - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.. _ubuntu_zfs: | ||
|
||
=================== | ||
Ubuntu上运行ZFS | ||
=================== | ||
|
||
.. note:: | ||
|
||
本文实践是为 :ref:`install_kubeflow_single_command` 准备NFS共享存储,借这个机会来完成ZFS的完整部署和输出服务 | ||
|
||
准备工作 | ||
============= | ||
|
||
我在 :ref:`hpe_dl360_gen9` 二手服务器上安装了一块二手的 :ref:`sandisk_cloudspeed_eco_gen_ii_sata_ssd` ,虽然只是单块磁盘,但是可以用来作为测试环境的数据存储。构建全功能的ZFS,实现数据共享给 :ref:`machine_learning` 这样需要NFS的环境。 | ||
|
||
注意,我的物理服务器 ``zcloud`` 采用了 :ref:`ubuntu_linux` 22.04,可以采用OpenZFS官方仓库安装 | ||
|
||
安装 | ||
========= | ||
|
||
在Ubuntu发行版中,ZFS是包含在默认的Linux内核包中,所以不需要像 :ref:`archlinux_zfs` 通过内核编译支持,只需要安装ZFS utilities。 | ||
|
||
- 配置 ``/etc/apt/sources.lists`` 确保已经激活了 ``universe`` (可能已经激活): | ||
|
||
.. literalinclude:: ubuntu_zfs/sources.list | ||
:caption: 确保 ``/etc/apt/sources.lists`` 已激活 ``universe`` | ||
:emphasize-lines: 3 | ||
|
||
- 安装 ``zfsutils-linux`` : | ||
|
||
.. literalinclude:: ubuntu_zfs/install_zfsutils | ||
:caption: 在Ubuntu环境安装 ``zfsutils-linux`` | ||
|
||
So easy。现在我们可以开始配置 | ||
|
||
参考 | ||
====== | ||
|
||
- `OpenZFS: Getting Started - Ubuntu <https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/index.html>`_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
apt update | ||
apt install zfsutils-linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
deb http://archive.ubuntu.com/ubuntu jammy main restricted | ||
deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted | ||
deb http://archive.ubuntu.com/ubuntu jammy universe | ||
deb http://archive.ubuntu.com/ubuntu jammy-updates universe | ||
... |