<p>Getting access denied error while running the systemctl command in a pod.</p>

<p>Whenever try to start any service, for example, MySQL or tomcat server in a pod, it gives access denied error.</p>

<p>Is there any way by which I can run systemctl within a pod.</p>

<p>This is a problem related to Docker, not Kubernetes.
According to the page <a href="https://docs.docker.com/config/containers/multi-service_container/" rel="nofollow noreferrer">Run multiple services in a container</a> in docker docs: </p>

<blockquote>
  <p>It is generally recommended that you separate areas of concern by
  using one service per container</p>
</blockquote>

<p>However if you really want to use a process manager, you can try <em>supervisord</em>, which allows you to use <em>supervisorctl</em> commands, similar to <em>systemctl</em>. The page above explains how to do that:</p>

<blockquote>
  <p>Here is an example Dockerfile using this approach, that assumes the
  pre-written supervisord.conf, my_first_process, and my_second_process
  files all exist in the same directory as your Dockerfile.</p>
</blockquote>

<pre><code>FROM ubuntu:latest
RUN apt-get update &amp;&amp; apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY my_first_process my_first_process
COPY my_second_process my_second_process
CMD ["/usr/bin/supervisord"]
</code></pre>
