I'm trying to deploy a docker container to my Kubernetes cluster, but I'm running into an issue with passing the required command-line arguments to the container. I need to pass two arguments called --provider local
and --basedir /tmp
. Here is what the docker run command looks like (I can run this without any issues on my docker host):
docker run -d -p 8080:8080 --name transfer-sh -v /tmp:/tmp dutchcoders/transfer.sh:latest --provider local --basedir /tmp
However, when I apply the deployment YAML to my cluster the container fails with this error (I'm running kubectl apply -f deploy.yaml
to apply my changes to the cluster):
Incorrect Usage. flag provided but not defined: -provider local
So my YAML specifies that the flag should be --provider
, but for some reason I haven't been able to find yet the container only sees -provider
which is indeed not a valid option. This is the full help message:
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
.
If anyone has any thoughts I could use the help. I'm a bit stuck at the moment (although still troubleshooting). I am curious if maybe there is a different way to pass in command flags as opposed to arguments (or maybe there isn't any difference as far as k8s is concerned).
CodePudding user response:
Try:
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