# I want to apt-get install sysstat command in my yaml file

**URL:** <https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356>\
**Category:** General Discussions\
**Created:** [June 10, 2020, 3:55am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356 "2020-06-10T03:55:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bawoo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/bawoo/32/2656_2.png) [@Bawoo](https://discuss.kubernetes.io/u/Bawoo)\
**Post date:** [June 10, 2020, 3:55am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/1 "2020-06-10T03:55:48Z")

</div>

Asking for help? Comment out what you need so we can get more information to help you!

### Cluster information:

Kubernetes version: 1.18  
Cloud being used: (put bare-metal if not on a public cloud) AWS EKS  
Host OS: debian linux

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

When I deploy pods,I want to my pod to install sysstat automatically

this is my two yaml flies below but it doesn’t work CrashLoopBackoff when I put the **command: ["/bin/sh", “-c”]、args: [“apt-get install sysstat”]**」 below 「image:」

cat deploy/db/statefulset.yaml

```auto
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: 
    sbdemo-postgres-sfs
spec:
  serviceName: sbdemo-postgres-service
  replicas: 1
  selector:
    matchLabels:
      app: sbdemo-postgres-sfs
  template:
    metadata:
      labels:
        app: sbdemo-postgres-sfs
    spec:
      containers:
       - name: postgres
         image: dayan888/springdemo:postgres9.6
         ports:
          - containerPort: 5432
         **command: ["/bin/bash", "-c"]**
         **args: ["apt-get install sysstat"]**
         volumeMounts:
         - name: pvc-db-volume
           mountPath: /var/lib/postgresql
  volumeClaimTemplates:
  - metadata:
      name: pvc-db-volume
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1G

```

cat deploy/web/deployment.yaml

```auto
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sbdemo-nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: sbdemo-nginx
  template:
    metadata:
      labels:
        app: sbdemo-nginx
    spec:
      containers:
      - name: nginx
        image: gobawoo21/springdemo:nginx
         **command: ["/bin/bash", "-c"]**
         **args: ["apt-get install sysstat"]**
        ports:
        - containerPort: 80
        volumeMounts:
        - name: nginx-conf
          mountPath: /etc/nginx/nginx.conf
          subPath: nginx.conf
        - name: server-conf
          mountPath: /etc/nginx/conf.d/server.conf
          subPath: server.conf
      volumes:
      - name: nginx-conf
        configMap: 
          name: nginx-conf
          items:
            - key: nginx.conf
              path: nginx.conf
      - name: server-conf
        configMap: 
          name: server-conf
          items:
            - key: server.conf
              path: server.conf

```

Does anyone know about how to set the repository automatically when deploy pods?

Regards

---

<div class="post-metadata">

**Author:** ![tej-singh-rana](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tej-singh-rana/32/5921_2.png) [@tej-singh-rana](https://discuss.kubernetes.io/u/tej-singh-rana)\
**Post date:** [June 10, 2020, 8:25am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/2 "2020-06-10T08:25:20Z")

</div>

when you used this command and args in your yaml file. Basically it override your dockerimage default CMD path. That’s why you are having Crashloopback off error. If you want this repo in your Pod container then modify docker image via Dockerfile and then try it.

---

<div class="post-metadata">

**Author:** ![Bawoo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/bawoo/32/2656_2.png) [@Bawoo](https://discuss.kubernetes.io/u/Bawoo)\
**Post date:** [June 10, 2020, 9:01am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/3 "2020-06-10T09:01:10Z")

</div>

Thank you for your reply  
You mean modify Dockerfile add CMD path like below if I want to use command and args?  
here is my original Dockerfile  
How to I modify my Dockerfile when I want to that commands?  
I’m sorry for my pool understanding my English and Dockerfile

```auto
FROM nginx:latest

COPY deploy/web/nginx.conf /etc/nginx/nginx.conf
COPY deploy/web/server.conf /etc/nginx/conf.d/server.conf
COPY src/main/resources/static/css /usr/share/nginx/html/css
COPY src/main/resources/static/js /usr/share/nginx/html/js
COPY src/main/resources/static/img /usr/share/nginx/html/img

```

Best Regards

---

<div class="post-metadata">

**Author:** ![tej-singh-rana](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tej-singh-rana/32/5921_2.png) [@tej-singh-rana](https://discuss.kubernetes.io/u/tej-singh-rana)\
**Post date:** [June 10, 2020, 9:20am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/4 "2020-06-10T09:20:30Z")

</div>

I think nginx not support apt-get install package. When i worked with this only can host web pages only

---

<div class="post-metadata">

**Author:** ![tej-singh-rana](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tej-singh-rana/32/5921_2.png) [@tej-singh-rana](https://discuss.kubernetes.io/u/tej-singh-rana)\
**Post date:** [June 10, 2020, 9:22am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/5 "2020-06-10T09:22:27Z")

</div>

If you have no issue of image or it’s size then pick ubuntu image. other option — Docker provides multi-stagging option as well.  
`https://docs.docker.com/develop/develop-images/multistage-build/`

---

<div class="post-metadata">

**Author:** ![Bawoo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/bawoo/32/2656_2.png) [@Bawoo](https://discuss.kubernetes.io/u/Bawoo)\
**Post date:** [June 10, 2020, 9:30am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/6 "2020-06-10T09:30:58Z")

</div>

Thank you  
but when I deploy nginx pod and use kubectl exec it – /bin/bash into the pod  
It’s a debian linux  
and use command apt-get update or install works well

---

<div class="post-metadata">

**Author:** ![tej-singh-rana](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tej-singh-rana/32/5921_2.png) [@tej-singh-rana](https://discuss.kubernetes.io/u/tej-singh-rana)\
**Post date:** [June 10, 2020, 9:39am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/7 "2020-06-10T09:39:27Z")

</div>

Because you are doing this after creation of Pod. In the backend for a general idea parent process of debian linux is on and when you enter by manually kubectl exec. You are doing or hitting child process of container.  
When Pod creation time container using Parent process (CMD or ENTRYPOINT) what ever it is. After container created you are doing by kubectl exec --\> Child process.  
This scenario is same for Docker containers.

---

<div class="post-metadata">

**Author:** ![Bawoo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/bawoo/32/2656_2.png) [@Bawoo](https://discuss.kubernetes.io/u/Bawoo)\
**Post date:** [June 10, 2020, 10:05am UTC](https://discuss.kubernetes.io/t/i-want-to-apt-get-install-sysstat-command-in-my-yaml-file/11356/8 "2020-06-10T10:05:06Z")

</div>

I really really appreciate your comment.  
I understand your comments  
Thankyou very much!
