• 自学k8s-k8s中对资源命名时注意不能使用下划线


    错误样例

    [root@kubemaster ~]# cat cw_test.yaml 
    apiVersion: v1
    kind: Pod
    metadata:
      name: pod_demo_cw
      namespace: default
      labels:
        app: ngix_test_pod
    spec:
      containers:
        - name: ngix_test_cw
          image: 10.37.218.29:5000/suning/wildfly_oraclejdk1.7_110:20181220   
    

    执行的过程中,提示如下错误:

    [root@kubemaster ~]# kubectl create -f ./cw_test.yaml 
    The Pod "pod_demo_cw" is invalid: 
    * metadata.name: Invalid value: "pod_demo_cw": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
    * spec.containers[0].name: Invalid value: "ngix_test_cw": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?') 

    修改成中划线

    apiVersion: v1
    kind: Pod
    metadata:
      name: pod-demo-cw
      namespace: default
      labels:
        app: ngix-test-pod
    spec:
      containers:
        - name: ngix-test-cw
          image: 10.37.218.29:5000/suning/wildfly_oraclejdk1.7_110:20181220

    验证

    [root@kubemaster ~]# kubectl get pod
    NAME                            READY   STATUS    RESTARTS   AGE
    pod-demo-cw                     1/1     Running   0          7s
    redhat-nginx-59fc448665-9bqmr   1/1     Running   0          21d
    redhat-nginx-59fc448665-fntgt   1/1     Running   0          28d
    redhat-nginx-59fc448665-sxt64   1/1     Running   0          21d
    [root@kubemaster ~]# vim cw_test.yaml +3
    [root@kubemaster ~]# kubectl get pod pod-demo-cw
    NAME          READY   STATUS    RESTARTS   AGE
    pod-demo-cw   1/1     Running   0          3m36s
    [root@kubemaster ~]# 
    

      

      

     

     

  • 相关阅读:
    C#中判断为空
    ArcGIS中的AddIn开发示例
    当前不会命中断点,还没有加载该文档加载任何符号
    设置ArcGIS的外观改回到出厂
    读取Style符号库样式的方法
    ArcEngine中的缩放地图
    修改字段结构之GP工具
    修改字段结构之ArcGIS Diagrammer
    merage语句
    Windows下Redis的安装使用
  • 原文地址:https://www.cnblogs.com/potato-chip/p/13998793.html
Copyright © 2020-2023  润新知