I saw that there is an object named PodTemplate which have little documentation.
It is mentioned:
Pod templates are pod specifications which are included in other objects, such as Replication Controllers, Jobs, and DaemonSets.
But I am not sure how to mention it on Replication Controllers, Jobs or DaemonSets.
I created a PodTemplate like this:
kubectl apply -f - <<EOF
apiVersion: v1
kind: PodTemplate
metadata:
name: pod-test
namespace: default
template:
metadata:
name: pod-template
spec:
containers:
- name: container
image: alpine
command: ["/bin/sh"]
args: ["-c", "sleep 100"]
EOF
I want to use it in a DaemonSet, how can I do it ?
Here is an example for DaemonSet YAML:
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: pod-by-daemonset
namespace: default
spec:
selector:
matchLabels:
name: selector
template:
metadata:
labels:
name: selector
spec:
containers: # I don't want to specify it, I want to use the template.
- name: container
image: alpine
EOF