You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建Deployment时extensions/v1beta1版本正则验证失败求助

Fixing the Kubernetes Deployment Regex Validation Error for extensions/v1beta1

Hey there, let's break down exactly what's causing that frustrating regex error and get your Deployment up and running.

1. Root Cause of the Error

That regex validation failure (quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$') is pointing to a simple but critical issue: your resource limit values aren't in a format Kubernetes understands.

Looking at your YAML, the resources.limits section uses placeholder variables like $SPARK_MASTER_MEMORY and $SPARK_MASTER_CPU—Kubernetes can't parse these as valid resource quantities. The mention of extensions/v1beta1 in the error is a red herring here; the real problem is unprocessed variables in your resource definitions.

2. Step-by-Step Fixes

Replace Placeholder Variables with Valid Resource Values

Kubernetes requires specific formats for CPU and memory quantities:

  • Memory: Use units like Mi (mebibytes), Gi (gibibytes), M (megabytes), or G (gigabytes). Example: 1Gi, 512Mi
  • CPU: Use whole numbers (for full cores) or m for millicores (1 core = 1000m). Example: 1, 750m

Update your resources block with concrete values:

resources:
  limits:
    memory: '1Gi'  # Replace with your actual master memory requirement
    cpu: '500m'    # Replace with your actual master CPU requirement

Your Kubectl client is v1.6.4, while the server is v1.5.7. In Kubernetes 1.6+, Deployment resources moved from extensions/v1beta1 to apps/v1beta1. While extensions/v1beta1 still works on v1.5, switching to apps/v1beta1 will make your YAML more future-compatible:

kind: Deployment
apiVersion: apps/v1beta1  # Updated from extensions/v1beta1
metadata:
  name: sf-spark-master
# ... rest of your YAML remains the same

Validate Variable Substitution (If Using CI/CD)

If those $ variables are supposed to be replaced by a CI/CD pipeline (like Jenkins or GitLab CI), double-check that the pipeline is correctly substituting them before applying the YAML. You can test locally with a dry-run to catch issues early:

kubectl --kubeconfig=/var/go/.kube/mcc-pp-config --context=sam-mcc2-pp --namespace=sam-mcc2-pp apply -f k8s-config-sam-mcc2-pp/sf-spark-worker-deployment.yaml --record --dry-run

3. Final Verification

Once you've updated the resource values (and optionally the API version), run your original apply command again—it should succeed without the regex error.

内容的提问来源于stack exchange,提问作者Ritabrata

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:39:00