​
Select Service
ves-io-schema-k8s_pod_security_policy-API-Create
Published April 5, 2023 | Last modified September 10, 2026
Examples of creating k8s_pod_security_policy
Usecase:
Create pod-security-policy-1
Request using vesctl:
vesctl configuration create k8s_pod_security_policy -i k8s_pod_security_policy.yaml
where file k8s_pod_security_policy.yaml has following contents (k8s_pod_security_policy.CreateRequest):
RequestJSON:
{ "metadata": { "name": "pod-security-policy-1", "namespace": "system" }, "spec": { "psp_spec": { "no_default_capabilities": {}, "no_allowed_capabilities": {}, "no_drop_capabilities": {}, "volumes": [ "config" ], "read_only_root_filesystem": true, "host_network": true, "no_run_as_user": {}, "no_run_as_group": {}, "no_supplemental_groups": {}, "no_fs_groups": {}, "no_se_linux_options": {}, "no_runtime_class": {} } }}vesctl yaml response:
ResponseJSON:
{ "metadata": { "name": "pod-security-policy-1", "namespace": "system", "labels": {}, "annotations": {}, "description": "", "disable": false }, "system_metadata": { "uid": "544055fe-f7c7-428b-821a-4cea658a775e", "creation_timestamp": "2026-06-19T22:03:24.591903Z", "deletion_timestamp": null, "modification_timestamp": null, "initializers": null, "finalizers": [], "tenant": "acmecorp", "creator_class": "examplesvc", "creator_id": "examplesvc", "object_index": 0, "owner_view": null, "labels": {} }, "spec": { "psp_spec": { "privileged": false, "allow_privilege_escalation": false, "default_allow_privilege_escalation": false, "no_default_capabilities": {}, "no_allowed_capabilities": {}, "no_drop_capabilities": {}, "volumes": [ "config" ], "allowed_flex_volumes": [], "allowed_host_paths": [], "allowed_proc_mounts": [], "read_only_root_filesystem": true, "allowed_csi_drivers": [], "host_network": true, "host_port_ranges": "", "host_ipc": false, "host_pid": false, "allowed_unsafe_sysctls": [], "forbidden_sysctls": [], "no_run_as_user": {}, "no_run_as_group": {}, "no_supplemental_groups": {}, "no_fs_groups": {}, "no_se_linux_options": {}, "no_runtime_class": {} } }}Request using curl:
curl -X 'POST' -d '{"metadata":{"name":"pod-security-policy-1","namespace":"system"},"spec":{"psp_spec":{"no_default_capabilities":{},"no_allowed_capabilities":{},"no_drop_capabilities":{},"volumes":["config"],"read_only_root_filesystem":true,"host_network":true,"no_run_as_user":{},"no_run_as_group":{},"no_supplemental_groups":{},"no_fs_groups":{},"no_se_linux_options":{},"no_runtime_class":{}}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_var_folders_q2_3kp8z3zs0x5_m7pk1bgb0_ph0000gp_T_go-build1655461974_b001_apidocs.test/host=MTY6VVHQPH/svc=S:examplesvc/site=mytestce01' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/k8s_pod_security_policys'curl response:
HTTP/1.1 200 OKContent-Type: application/jsonDate: Fri, 19 Jun 2026 22:03:24 GMTVary: Accept-Encoding
{ "metadata": { "name": "pod-security-policy-1", "namespace": "system", "labels": { }, "annotations": { }, "description": "", "disable": false }, "system_metadata": { "uid": "544055fe-f7c7-428b-821a-4cea658a775e", "creation_timestamp": "2026-06-19T22:03:24.591903Z", "deletion_timestamp": null, "modification_timestamp": null, "initializers": null, "finalizers": [ ], "tenant": "acmecorp", "creator_class": "examplesvc", "creator_id": "examplesvc", "object_index": 0, "owner_view": null, "labels": { } }, "spec": { "psp_spec": { "privileged": false, "allow_privilege_escalation": false, "default_allow_privilege_escalation": false, "no_default_capabilities": {
}, "no_allowed_capabilities": {
}, "no_drop_capabilities": {
}, "volumes": [ "config" ], "allowed_flex_volumes": [ ], "allowed_host_paths": [ ], "allowed_proc_mounts": [ ], "read_only_root_filesystem": true, "allowed_csi_drivers": [ ], "host_network": true, "host_port_ranges": "", "host_ipc": false, "host_pid": false, "allowed_unsafe_sysctls": [ ], "forbidden_sysctls": [ ], "no_run_as_user": {
}, "no_run_as_group": {
}, "no_supplemental_groups": {
}, "no_fs_groups": {
}, "no_se_linux_options": {
}, "no_runtime_class": {
} } }}