-1

I have attached the Kubernetes script wherein the argument has "-c" why it is required t be provided?

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  labels:
    run: ngn
  name: ngn
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      run: ngn
  template:
    metadata:
      labels:
        run: ngn
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: ngn
        command: ["/bin/sh"]
        args: ["-c", "while true; do echo hello; sleep 10;done"]
P....
  • 17,421
  • 2
  • 32
  • 52
kumar
  • 31
  • 6
  • This help me to understand https://stackoverflow.com/questions/26167803/how-does-bin-bash-c-differ-from-executing-a-command-directly – kumar Dec 17 '20 at 03:13

1 Answers1

2

The -c you are asking here is an argument to /bin/sh, Here in your snippet you are supplying while true; do echo hello; sleep 10;done to /bin/sh as an argument.

       -c               Read commands from the command_string operand instead of from the standard input.  Special parameter 0 will be set from the
                        command_name operand and the positional parameters ($1, $2, etc.)  set from the remaining argument operands.
P....
  • 17,421
  • 2
  • 32
  • 52