#kubernetes #service-account #copr #resalloc

app resalloc-kubernetes

用于为resalloc框架分配kubernetes pod资源的CLI工具

6个版本 (稳定)

1.0.5 2023年9月15日
1.0.4 2023年9月8日
1.0.3 2023年8月23日
1.0.2 2023年6月6日
0.1.0 2022年12月9日

#8 in #service-account

Download history 5/week @ 2024-03-29

每月下载量 52

MIT 协议

34KB
765

Resalloc kubernetes

resalloc-kubernetes用于在COPR集群中生成集群内pod资源。

先决条件

Pod的服务账号角色需要具有pvc的createdelete和pod的createdeletelistwatchget权限。例如,RBAC角色可能如下所示:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
...
rules:
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["create", "delete", "list", "get", "watch"]
- apiGroups: [""]
  resources: ["persistentvolumeclaims"]
  verbs: ["create", "delete"]
...

注意:如果服务账号中没有pod和pvc的delete权限,分配的资源可能会泄露,需要手动释放!

生成Pod

命令如下:

Create new pod resource

Usage: resalloc-kubernetes add [OPTIONS] --image-tag <IMAGE_TAG> --cpu-resource <CPU_RESOURCE> --memory-resource <MEMORY_RESOURCE>

Options:
      --timeout <TIMEOUT>
          timeout for waiting pod to be ready [default: 60]
      --image-tag <IMAGE_TAG>
          specify the image tag used for generating, for example: docker.io/organization/image:tag
      --namespace <NAMESPACE>

      --cpu-resource <CPU_RESOURCE>
          specify the request and limit cpu resource, '1', '2000m' and etc.
      --memory-resource <MEMORY_RESOURCE>
          specify the request and limit memory resource, '1024Mi', '2Gi' and etc.
      --node-selector <NODE_SELECTOR>
          specify the node selector for pod resource in the format of 'NAME=VALUE', can be specified with multiple times
      --privileged
          run pod in privileged mode

      --additional-labels <ADDITIONAL_LABELS>
          specify the additional labels for pod resource in the format of 'NAME=VALUE', can be specified with multiple times
      --additional-volume-size <ADDITIONAL_VOLUME_SIZE>
          specify the additional persistent volume size, use in group(additional_volume_size, additional_volume_class, additional_volume_mount_path).
      --additional-volume-class <ADDITIONAL_VOLUME_CLASS>
          specify the additional persistent volume class, use in group(additional_volume_size, additional_volume_class, additional_volume_mount_path).
      --additional-volume-mount-path <ADDITIONAL_VOLUME_MOUNT_PATH>
          specify mount point for persistent volume, use in group(additional_volume_size, additional_volume_class, additional_volume_mount_path).
  -h, --help
          Print help information

移除Pod

命令如下:

Delete existing pod resource by IP address

Usage: resalloc-kubernetes delete [OPTIONS] --name <NAME>

Options:
      --name <NAME>            specify ip address of pod to delete. [env: RESALLOC_NAME=]
      --namespace <NAMESPACE>
  -h, --help                   Print help information

依赖项

~78MB
~1M SLoC