<p>It is possible to define commands in the Kubernetes for a Deployment that are to be executed immediately after creating the deployment?</p>

<p>for example:</p>

<pre><code>cd opt/
wget xxxxxx
mkdir new/
</code></pre>

<p>I have not found any solution to this problem so far.</p>

<p>Is there any other method to get this effect?</p>

<p>This could be done like this:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: example
  name: example
spec:
  replicas: 1
  selector:
    matchLabels:
      app: example
  strategy: {}
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
        - image: busybox
          command: ["/bin/sh"]
          args: ["-c", "cd opt/ &amp;&amp;  wget xxxxxx &amp;&amp; mkdir new/ &amp;&amp; process-that-keeps-container-running"]
          name: busybox
</code></pre>

<p>It's a bit tricky, since at the end of the command arguments, you will have to place the command that keeps the containers running. If you don't know which one this is, you will have to look at <code>CMD</code> and <code>ENTRYPOINT</code> of the Docker image you are using.</p>
