1"use strict";(self.webpackChunkdevspace_cloud=self.webpackChunkdevspace_cloud||[]).push([[2793],{90602(e,n,s){s(74848)},84257(e,n,s){s.d(n,{Ay:()=>o,RM:()=>l});var t=s(74848),a=s(28453);const l=[{value:"Example: Custom Kubectl Args & Flags",id:"example-custom-kubectl-args--flags",level:4}];function i(e){const n={admonition:"admonition",code:"code",h4:"h4",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"applyArgs"})," option expects an array of strings stating additional arguments (and flags) that should be used when calling ",(0,t.jsx)(n.code,{children:"kubectl apply"}),"."]}),"\n",(0,t.jsx)(n.admonition,{title:"Apply for Kustomize Deployments",type:"info",children:(0,t.jsxs)(n.p,{children:["Even if you set ",(0,t.jsx)(n.code,{children:"kustomize: true"}),", DevSpace only renders the manifest templates using kustomize but the actual deployment will be executed using ",(0,t.jsx)(n.code,{children:"kubectl apply"}),"."]})}),"\n",(0,t.jsx)(n.h4,{id:"example-custom-kubectl-args--flags",children:"Example: Custom Kubectl Args & Flags"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-yaml",children:'deployments:\n backend:\n kubectl:\n manifests:\n - backend/\n applyArgs:\n - "--timeout"\n - "10s"\n - "--grace-period"\n - "30"\n'})}),"\n",(0,t.jsx)(n.p,{children:"Deploying the above example would roughly be equivalent to this command:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"kubectl apply --timeout=10s --grace-period=30 -f backend/\n"})})]})}function o(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(i,{...e})}):i(e)}},20774(e,n,s){s(74848)},53918(e,n,s){s.d(n,{Ay:()=>o,RM:()=>l});var t=s(74848),a=s(28453);const l=[{value:"Example: Enable Tag Updates",id:"example-enable-tag-updates",level:4}];function i(e){const n={admonition:"admonition",code:"code",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["If the ",(0,t.jsx)(n.code,{children:"updateImageTags"})," field is set to ",(0,t.jsx)(n.code,{children:"true"})," for a deployment, DevSpace will replace/update all image tags before deploying the project."]}),"\n",(0,t.jsxs)(n.p,{children:["When enabled, DevSpace searches all your manifests for images that are defined in the ",(0,t.jsx)(n.code,{children:"images"})," section of the ",(0,t.jsx)(n.code,{children:"devspace.yaml"}),". If DevSpace finds an image, it replaces or appends the image tag with the tag it created during the image building process. Image tag replacement makes sure that your application will always be started with the most up-to-date image that DevSpace has built for you."]}),"\n",(0,t.jsx)(n.h4,{id:"example-enable-tag-updates",children:"Example: Enable Tag Updates"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-yaml",metastring:"{3}",children:"deployments:\n backend:\n updateImageTags: true\n kubectl:\n manifests:\n - backend/\n"})}),"\n",(0,t.jsx)(n.admonition,{title:"In-Memory Tag Replacement",type:"info",children:(0,t.jsxs)(n.p,{children:["Tag replacement takes place ",(0,t.jsx)(n.strong,{children:"in-memory"})," and is ",(0,t.jsx)(n.strong,{children:"not"})," writing anything to the filesystem, i.e. it will ",(0,t.jsx)(n.strong,{children:"never"})," change any of your configuration files."]})})]})}function o(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(i,{...e})}):i(e)}},34659(e,n,s){s.d(n,{Ay:()=>o,RM:()=>l});var t=s(74848),a=s(28453);const l=[{value:"Example: Custom Kustomize Args & Flags",id:"example-custom-kustomize-args--flags",level:4}];function i(e){const n={code:"code",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"kustomizeArgs"}
1)," option expects an array of strings stating additional arguments (and flags) that should be used when calling ",(0,t.jsx)(n.code,{children:"kustomize build"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"example-custom-kustomize-args--flags",children:"Example: Custom Kustomize Args & Flags"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-yaml",children:'deployments:\n- name: backend\n kubectl:\n manifests:\n - backend/\n kustomize: true\n kustomizeArgs:\n - "--timeout"\n - "10s"\n - "--grace-period"\n - "30"\n'})}),"\n",(0,t.jsx)(n.p,{children:"Deploying the above example would roughly be equivalent to this command:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"kustomize build --timeout=10s --grace-period=30 -f backend/\n"})}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.strong,{children:"Note:"})," Directly copying the example shown above would result in your deploy failing (it would result in ",(0,t.jsx)(n.code,{children:"Error: unknown flag: --timeout"}),")."]})]})}function o(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(i,{...e})}):i(e)}},23678(e,n,s){s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>r,default:()=>m,frontMatter:()=>c,metadata:()=>t,toc:()=>p});const t=JSON.parse('{"id":"configuration/deployments/kubectl/inline_manifests","title":"Deploy Kubernetes Inline Manifests","description":"To deploy Kubernetes using inline manifests with kubectl apply, you need to configure them within the deployments section of the devspace.yaml.","source":"@site/pages/configuration/deployments/kubectl/inline_manifests.mdx","sourceDirName":"configuration/deployments/kubectl","slug":"/configuration/deployments/kubectl/inline_manifests","permalink":"/docs/configuration/deployments/kubectl/inline_manifests","draft":false,"unlisted":false,"editUrl":"https://github.com/loft-sh/devspace/edit/main/docs/pages/configuration/deployments/kubectl/inline_manifests.mdx","tags":[],"version":"current","lastUpdatedAt":1676296530000,"frontMatter":{"title":"Deploy Kubernetes Inline Manifests","sidebar_label":"InlineManifests"},"sidebar":"adminSidebar","previous":{"title":"Manifests","permalink":"/docs/configuration/deployments/kubectl/manifests"},"next":{"title":"Patches","permalink":"/docs/configuration/deployments/kubectl/patches"}}');var a=s(74848),l=s(28453),i=s(84257),o=(s(20774),s(90602),s(34659),s(53918));const c={title:"Deploy Kubernetes Inline Manifests",sidebar_label:"InlineManifests"},r=void 0,d={},p=[{value:"Example",id:"example",level:2},{value:"Update Image Tags",id:"update-image-tags",level:2},...o.RM,{value:"<code>kubectl</code> Binary",id:"kubectl-binary",level:2},{value:"Extra Arguments",id:"extra-arguments",level:2},{value:"Args For <code>kubectl create</code>",id:"args-for-kubectl-create",level:3},{value:"Example: Custom Kubectl Args & Flags",id:"example-custom-kubectl-args--flags",level:4},{value:"Args For <code>kubectl apply</code>",id:"args-for-kubectl-apply",level:3},...i.RM];function u(e){const n={a:"a",br:"br",code:"code",h2:"h2",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,l.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(n.p,{children:["To deploy Kubernetes using inline manifests with ",(0,a.jsx)(n.code,{children:"kubectl apply"}),", you need to configure them within the ",(0,a.jsx)(n.code,{children:"deployments"})," section of the ",(0,a.jsx)(n.code,{children:"devspace.yaml"}),"."]}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-yaml",metastring:"title=devspace.yaml",children:'pipelines:\n dev: \n run: |\n create_deployments backend\n create_deployments frontend\ndeployments:\n backend:\n kubectl:\n inlineManifest: |-\n apiVersion: v1\n kind: Pod\n metadata:\n name: busybox-sleep\n spec:\n containers:\n - name: busybox\n image: busybox:1.28\n args:\n - sleep\n - "1000000"\n frontend:\n
1kubectl:\n manifests:\n - frontend/manifest.yaml\n'})}),"\n",(0,a.jsx)(n.p,{children:"The above example will be executed during the deployment process as follows:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:'cat <<EOF | kubectl apply -f -\napiVersion: v1\nkind: Pod\nmetadata:\n name: busybox-sleep\nspec:\n containers:\n - name: busybox\n image: busybox:1.28\n args:\n - sleep\n - "1000000"\nEOF\n'})}),"\n",(0,a.jsx)(n.p,{children:"You can also use variables:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-yaml",children:'vars:\n CONTAINER_NAME: $(cat my-example.txt)\n\ndeployments:\n backend:\n kubectl:\n inlineManifest: |-\n apiVersion: v1\n kind: Pod\n metadata:\n name: busybox-sleep\n spec:\n containers:\n - name: ${CONTAINER_NAME}\n # name: $(cat my-example.txt) won\'t work!\n image: busybox:1.28\n args:\n - sleep\n - "1000000"\n createArgs:\n - "--recursive"\n'})}),"\n",(0,a.jsx)(n.h2,{id:"update-image-tags",children:"Update Image Tags"}),"\n",(0,a.jsx)(o.Ay,{}),"\n",(0,a.jsxs)(n.h2,{id:"kubectl-binary",children:[(0,a.jsx)(n.code,{children:"kubectl"})," Binary"]}),"\n",(0,a.jsxs)(n.p,{children:["Deployments with ",(0,a.jsx)(n.code,{children:"kubectl"})," require ",(0,a.jsx)(n.code,{children:"kubectl"})," to be installed. If the ",(0,a.jsx)(n.code,{children:"kubectl"})," binary cannot be found within the ",(0,a.jsx)(n.code,{children:"$PATH"})," variable and it is not specified by specifying the ",(0,a.jsxs)(n.a,{href:"/docs/configuration/deployments/kubectl/#deployments-kubectl-kubectlBinaryPath",children:[(0,a.jsx)(n.code,{children:"kubectlBinaryPath"})," option"]}),", DevSpace will download the ",(0,a.jsx)(n.code,{children:"kubectl"})," binary into the ",(0,a.jsx)(n.code,{children:"$HOME/.devspace/bin"})," folder."]}),"\n",(0,a.jsx)(n.h2,{id:"extra-arguments",children:"Extra Arguments"}),"\n",(0,a.jsxs)(n.p,{children:["When deploying manifests via ",(0,a.jsx)(n.code,{children:"kubectl"}),", DevSpace can pass additional arguments and flags to the ",(0,a.jsx)(n.code,{children:"kubectl"})," commands used for the deployment process."]}),"\n",(0,a.jsxs)(n.h3,{id:"args-for-kubectl-create",children:["Args For ",(0,a.jsx)(n.code,{children:"kubectl create"})]}),"\n",(0,a.jsxs)(n.p,{children:["The ",(0,a.jsx)(n.code,{children:"createArgs"})," option expects an array of strings stating additional arguments (and flags) that should be used when calling ",(0,a.jsx)(n.code,{children:"kubectl create"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"example-custom-kubectl-args--flags",children:"Example: Custom Kubectl Args & Flags"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-yaml",children:'deployments:\n backend:\n kubectl:\n inlineManifest: |-\n apiVersion: v1\n kind: Pod\n metadata:\n name: busybox-sleep\n spec:\n containers:\n - name: busybox\n image: busybox:1.28\n args:\n - sleep\n - "1000000"\n createArgs:\n - "--recursive"\n'})}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:"Explanation:"}),(0,a.jsx)(n.br,{}),"\n","Deploying the above example would roughly be equivalent to this command:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:'cat <<EOF | kubectl create --dry-run --output yaml --validate=false --recursive -f -\napiVersion: v1\nkind: Pod\nmetadata:\n name: busybox-sleep\nspec:\n containers:\n - name: busybox\n image: busybox:1.28\n args:\n - sleep\n - "1000000"\nEOF\n'})}),"\n",(0,a.jsxs)(n.h3,{id:"args-for-kubectl-apply",children:["Args For ",(0,a.jsx)(n.code,{children:"kubectl apply"})]}),"\n",(0,a.jsx)(i.Ay,{})]})}function m(e={}){const{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(u,{...e})}):u(e)}},28453(e,n,s){s.d(n,{R:()=>i,x:()=>o});var t=s(96540);const a={},l=t.createContext(a);function i(e){const n=t.useContext(l);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),t.createElement(l.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.