Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Last active March 22, 2024 14:17
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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