Services Resources - v1 offers a comprehensive suite of templates for Kubernetes Service resources, including Service, Endpoints, Ingress, and IngressClass, enabling efficient management of network services and traffic routing in clusters. These templates utilize a flexible, facet-based design with dynamic variable population, streamlining the creation and configuration of service-related resources while accommodating a wide range of networking scenarios in Kubernetes environments.
Authentication
Add API authentication details
Readme
User instructions for this resource
ConfigFacets' Service template is designed to create Kubernetes Service resources, which are used to expose applications running on a set of Pods. The template uses a combination of facets and variables to allow for flexible configurations.
Variables
: This global variable represents the identifier for the Service, used to access specific fields in the request values.__SVC_ID__
Collection Breakdown
- Base
{
"kind": "Service",
"facets": [
"master"
],
"metadata": "{{ __SVC_ID__.metadata }}",
"apiVersion": "v1",
"spec": {
"selector": "{{ __SVC_ID__.spec.selector }}"
}
}
Includes kind, apiVersion, metadata, and the core selector.
Always included due to the "master" facet.
- Ports
{
"spec": {
"ports": "{{ __SVC_ID__.spec.ports }}"
},
"facets": [
"addon:spec",
"addon:ports"
]
}
Defines the ports for the service.
Included with "addon:spec" and "addon:ports" facets.
- Service Type
{
"spec": {
"type": "{{ __SVC_ID__.spec.type }}"
},
"facets": [
"addon:spec",
"addon:type"
]
}
Specifies the type of service (e.g., ClusterIP, NodePort, LoadBalancer). Included with "addon:spec" and "addon:type" facets.
- Additional Specifications
{
"spec": {
"clusterIP": "{{ __SVC_ID__.spec.clusterIP }}"
},
"facets": [
"addon:spec",
"addon:clusterip"
]
},
{
"spec": {
"externalIPs": "{{ __SVC_ID__.spec.externalIPs }}"
},
"facets": [
"addon:spec",
"addon:externalips"
]
},
{
"spec": {
"externalName": "{{ __SVC_ID__.spec.externalName }}"
},
"facets": [
"addon:spec",
"addon:externalname"
]
}
Various optional fields like clusterIP, externalIPs, externalName, etc. Each has its own facet for flexible inclusion.
Examples
Check Request Body tab section to play around with interactive examples.
Install(
)Example
The Curl tab in the request section below provides the curl command for your resource.
curl -s -X POST "https://configfacets.com/apis/repos/kubernetes/service-resources/v1/resources/collections/service/exec?format=json" -d '{"facets":["master","addon:spec","addon:ports"],"values":{"basic_svc":{"spec":{"ports":[{"port":80,"protocol":"TCP","targetPort":9376}],"selector":{"app":"MyApp"}},"metadata":{"name":"my-service","namespace":"default"}}},"globalvars":{"__SVC_ID__":"basic_svc"}}' | kubectl apply -f -