I'm working on a project that allows you to put a special "yaml shebang" at the top of any kubernetes manifest. The shebang is actually valid yaml since it's interpreted as a comment. This allows you to combine the declarative kubernetes spec (yaml) with external controller (kubectl)
example my-app.yaml
#!/usr/local/bin/kubectl -f
---
apiVersion: v1
kind: Namespace
metadata:
name: my-namespace
---
apiVersion: v1
kind: Pod
metadata:
name: my-pod
namespace: my-namespace
spec:
containers:
- name: nginx
image: docker.io/nginx:latest
ports:
- containerPort: 80
after making my-app.yaml executable you can now invoke the application's config to reconcile itself > chmod +x ./my-app.yaml
> ./my-app.yaml apply
namespace/my-namespace created
pod/my-pod created
> ./my-app.yaml get
NAME STATUS AGE
namespace/my-namespace Active 8s
NAME READY STATUS RESTARTS AGE
pod/my-pod 1/1 Running 0 7s
> ./my-app.yaml delete
namespace "my-namespace" deleted
pod "my-pod" deleted
obviously this is just a simple example but there is come really cool potential here.