Imperative
Description
Simple example in kubernetes
kubectl run testpod --image=busybox
Advanced Example in kubernetes
kubectl run my-pod --image=busybox --restart=Never --overrides='{ "spec": { "containers": [ { "name": "my-container", "command": [ "/bin/sh", "-c", "echo 'Hello, World!' && sleep 3600" ] } ] } }'
What are the advantages?
What is it best for?
Declarative
Description
Simple Example in kubernetes
Kubectl apply -f testpod.yaml
Testpod.yaml
apiVersion: v1
kind: Pod
metadata:
name: testpod
spec:
containers:
- name: busybox
image: busybox
Advanced Example in kubernetes
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
restartPolicy: Never
containers:
- name: my-container
image: busybox
command: ["/bin/sh", "-c", "echo 'Hello, World!' && sleep 3600"]
What are the advantages?
What is it best for?