Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Last active October 9, 2024 22:06
Show Gist options
  • Save zulhfreelancer/dc909185dde3a5ed5373ba0fd4ebb952 to your computer and use it in GitHub Desktop.
Save zulhfreelancer/dc909185dde3a5ed5373ba0fd4ebb952 to your computer and use it in GitHub Desktop.
How to run "kubectl apply -f" with inline YAML as stdin?
$ kubectl apply -f - <<EOF
<-- insert YAML content here -->
EOF

OR

$ cat file.yaml | kubectl apply -f -
@Grraahaam
Copy link

Maybe outdated, but here's the documentation : https://kubernetes.io/docs/reference/kubectl/cheatsheet/#creating-objects

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
  name: demo
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment