5

I use commands like sudo service memcached start to turn on various things after a reboot and I am wondering if it is possible to also tell this service to start memcached to start with certain flags, for example -vvv?

Any ideas? (The 'service' was automatically created when I installed through apt-get)

3 Answers3

3

You typically configure services like this using files in /etc. For this particular package, look at

/etc/default/memcached

Also, reading the man page for memcached will usually show you the location of the configuration files.

pestilence
  • 1,625
0

Kubernete's documention asks you to pass args to systemd services all the time.

The thing that sucks is that every implementation/flavor/distribution of Linux is different and installs things in different places !
And then on top of that every implementation/flavor/installation method of Kubernetes is different as well !!
And then, because that wasn't enough to deal with systemd has like 5 different methods of passing flags/arguments as well !!!

Thus the best way to do this seems to be:
To use the find command to find where *.service is located, and that won't always work either, because some implementations of systemd don't have you pass arguements in the *.service file, but if you search for the name of the service with the find command, you might find a config file where the EXTRA_ARGs are passed, thus I claim find command is the best method for linux noobs. Other than that you'd need to do a deep dive and truly learning the ins and outs of systemd/all 5ish different methods of passing args.

WorkerNodeBash# find / -name "*.service" | grep -i "kube"
WorkerNodeBash# nano /etc/systemd/system/kubelet.service

[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/kubernetes/kubernetes
After=containerd.service
Requires=containerd.service

[Service]
ExecStart=/usr/local/bin/kubelet \
  --config=/var/lib/kubelet/kubelet-config.yaml \
  --container-runtime=remote \
  --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock \
  --image-pull-progress-deadline=2m \
  --kubeconfig=/var/lib/kubelet/kubeconfig \
  --network-plugin=cni \
  --register-node=true \
  --pod-manifest-path=/etc/kubernetes/manifests \
  --v=2
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

(The above comes from Kubernetes the hard way implementation, I've also done kubeadm implementation and looked in this same file and saw no args AND when I tried to pass args they were ignored?, but thanks to learning how to use the find command I was able to search:
WorkerNodeBash# find / -type f -name "*.yaml" | grep "kube"
And I found a config file that mentioned KUBELET_EXTRA_ARGS=, and pass them in there.

neoakris
  • 263
0

After way too long searching, it seems that you have to add flags to /etc/memcached.conf

Alex
  • 253