我正在嘗試將 docker 容器部署到我的 Kubernetes 集群,但在將所需的命令列引數傳遞給容器時遇到了問題。我需要傳遞兩個名為--provider localand的引數--basedir /tmp。這是 docker run 命令的樣子(我可以在我的 docker 主機上運行它而不會出現任何問題):
docker run -d -p 8080:8080 --name transfer-sh -v /tmp:/tmp dutchcoders/transfer.sh:latest --provider local --basedir /tmp
但是,當我將部署 YAML 應用到我的集群時,容器失敗并出現此錯誤(我正在運行kubectl apply -f deploy.yaml以將我的更改應用到集群):
不正確的用法。提供但未定義的標志:-provider local
所以我的 YAML 指定標志應該是--provider,但由于某種原因,我還沒有找到容器只看到-provider哪個確實不是一個有效的選項。這是完整的幫助資訊:
NAME:
transfer.sh - transfer.sh
DESCRIPTION:
Easy file sharing from the command line
USAGE:
transfer.sh [flags] command [arguments...]
COMMANDS:
version
help, h Shows a list of commands or help for one command
FLAGS:
--listener value 127.0.0.1:8080 (default: "127.0.0.1:8080") [$LISTENER]
--profile-listener value 127.0.0.1:6060 [$PROFILE_LISTENER]
--force-https [$FORCE_HTTPS]
--tls-listener value 127.0.0.1:8443 [$TLS_LISTENER]
--tls-listener-only [$TLS_LISTENER_ONLY]
--tls-cert-file value [$TLS_CERT_FILE]
--tls-private-key value [$TLS_PRIVATE_KEY]
--temp-path value path to temp files (default: "/tmp") [$TEMP_PATH]
--web-path value path to static web files [$WEB_PATH]
--proxy-path value path prefix when service is run behind a proxy [$PROXY_PATH]
--proxy-port value port of the proxy when the service is run behind a proxy [$PROXY_PORT]
--email-contact value email address to link in Contact Us (front end) [$EMAIL_CONTACT]
--ga-key value key for google analytics (front end) [$GA_KEY]
--uservoice-key value key for user voice (front end) [$USERVOICE_KEY]
--provider value s3|gdrive|local [$PROVIDER]
--s3-endpoint value [$S3_ENDPOINT]
--s3-region value (default: "eu-west-1") [$S3_REGION]
--aws-access-key value [$AWS_ACCESS_KEY]
--aws-secret-key value [$AWS_SECRET_KEY]
--bucket value [$BUCKET]
--s3-no-multipart Disables S3 Multipart Puts [$S3_NO_MULTIPART]
--s3-path-style Forces path style URLs, required for Minio. [$S3_PATH_STYLE]
--gdrive-client-json-filepath value [$GDRIVE_CLIENT_JSON_FILEPATH]
--gdrive-local-config-path value [$GDRIVE_LOCAL_CONFIG_PATH]
--gdrive-chunk-size value (default: 16) [$GDRIVE_CHUNK_SIZE]
--storj-access value Access for the project [$STORJ_ACCESS]
--storj-bucket value Bucket to use within the project [$STORJ_BUCKET]
--rate-limit value requests per minute (default: 0) [$RATE_LIMIT]
--purge-days value number of days after uploads are purged automatically (default: 0) [$PURGE_DAYS]
--purge-interval value interval in hours to run the automatic purge for (default: 0) [$PURGE_INTERVAL]
--max-upload-size value max limit for upload, in kilobytes (default: 0) [$MAX_UPLOAD_SIZE]
--lets-encrypt-hosts value host1, host2 [$HOSTS]
--log value /var/log/transfersh.log [$LOG]
--basedir value path to storage [$BASEDIR]
--clamav-host value clamav-host [$CLAMAV_HOST]
--perform-clamav-prescan perform-clamav-prescan [$PERFORM_CLAMAV_PRESCAN]
--virustotal-key value virustotal-key [$VIRUSTOTAL_KEY]
--profiler enable profiling [$PROFILER]
--http-auth-user value user for http basic auth [$HTTP_AUTH_USER]
--http-auth-pass value pass for http basic auth [$HTTP_AUTH_PASS]
--ip-whitelist value comma separated list of ips allowed to connect to the service [$IP_WHITELIST]
--ip-blacklist value comma separated list of ips not allowed to connect to the service [$IP_BLACKLIST]
--cors-domains value comma separated list of domains allowed for CORS requests [$CORS_DOMAINS]
--random-token-length value (default: 6) [$RANDOM_TOKEN_LENGTH]
--help, -h show help
Here is the Docker Hub for the image I'm trying to deploy: dutchcoders/transfer.sh
Here is the GitHub: https://github.com/dutchcoders/transfer.sh
My cluster's version is 1.23.4 and the full deployment YAML is here:
apiVersion: apps/v1
kind: Deployment
metadata:
name: transfer-sh
namespace: transfer-sh
labels:
app: "transfer-sh"
spec:
replicas: 1
selector:
matchLabels:
app: transfer-sh
template:
metadata:
labels:
app: transfer-sh
spec:
containers:
- name: transfer-sh
image: dutchcoders/transfer.sh:latest
args:
- "--provider local"
- "--basedir /tmp"
ports:
- containerPort: 8080
I intentionally have not included any persistent volume claims yet. At this point I'm just testing to make sure the container will run.
Initially, I though maybe it was some sort of escape sequence issue. After trying all manner of ways to potentially escape the two dashes nothing really changed. I also tried setting environment variables that contained those arguments, but that just resulted in the same behavior where --profile turned into -profile.
如果有人有任何想法,我可以使用幫助。我現在有點卡住了(盡管仍在進行故障排除)。我很好奇是否可能有一種不同的方式來傳遞命令標志而不是引數(或者就 k8s 而言可能沒有任何區別)。
uj5u.com熱心網友回復:
嘗試:
apiVersion: apps/v1
kind: Deployment
metadata:
name: transfer-sh
namespace: transfer-sh
labels:
app: transfer-sh
spec:
replicas: 1
selector:
matchLabels:
app: transfer-sh
template:
metadata:
labels:
app: transfer-sh
spec:
containers:
- name: transfer-sh
image: dutchcoders/transfer.sh:latest
args: # <-- in this case each arg is individual
- --provider
- local
- --basedir
- /tmp
ports:
- containerPort: 8080
NAME READY UP-TO-DATE AVAILABLE AGE
transfer-sh 1/1 1 1 91s
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/443028.html
上一篇:如何檢查命名空間是否處于活動狀態
