启动apiserver时,增加 参数 --runtime-config=settings.k8s.io/v1alpha1=true

 

kind: PodPreset
apiVersion: settings.k8s.io/v1alpha1
metadata:
name: consul-setting
spec:
selector:
matchLabels:
name: consul
env:
- name: DATACENTER
value: default



[root@mhc test]# kubectl create -f consul-podpreset.yaml
podpreset "consul-setting" created
[root@mhc test]#
[root@mhc test]#
[root@mhc test]# kubectl get podpreset
NAME             AGE
consul-setting   4s