What is a headless service, what does it do/accomplish, and what are some legitimate use cases for it?

Well, I think you need some theory. There are many explanations (including the official docs) across the whole internet, but I think Marco Luksa did it the best: Each connection to the service is forwarded to one randomly selected backing pod. But what if the client needs to connect to all of those pods? What … Read more

How to automatically remove completed Kubernetes Jobs created by a CronJob?

You can now set history limits, or disable history altogether, so that failed or successful CronJobs are not kept around indefinitely. See my answer here. Documentation is here. To set the history limits: The .spec.successfulJobsHistoryLimit and .spec.failedJobsHistoryLimit fields are optional. These fields specify how many completed and failed jobs should be kept. By default, they … Read more

Kubernetes sort pods by age [closed]

Pods have status, which you can use to find out startTime. I guess something like kubectl get po –sort-by=.status.startTime should work. You could also try: kubectl get po –sort-by='{.firstTimestamp}’. kubectl get pods –sort-by=.metadata.creationTimestamp Thanks @chris Also apparently in Kubernetes 1.7 release, sort-by is broken. https://github.com/kubernetes/kubectl/issues/43 Here’s the bug report : https://github.com/kubernetes/kubernetes/issues/48602 Here’s the PR: https://github.com/kubernetes/kubernetes/pull/48659/files

What will happen to evicted pods in kubernetes?

A quick workaround I use, is to delete all evicted pods manually after an incident. You can use this command: kubectl get pods –all-namespaces -o json | jq ‘.items[] | select(.status.reason!=null) | select(.status.reason | contains(“Evicted”)) | “kubectl delete pods \(.metadata.name) -n \(.metadata.namespace)”‘ | xargs -n 1 bash -c

Checking kubernetes pod CPU and memory

CHECK WITHOUT METRICS SERVER or ANY THIRD PARTY TOOL If you want to check pods cpu/memory usage without installing any third party tool then you can get memory and cpu usage of pod from cgroup. Go to pod’s exec mode kubectl exec -it pod_name -n namespace — /bin/bash Run cat /sys/fs/cgroup/cpu/cpuacct.usage for cpu usage Run … Read more

pod has unbound PersistentVolumeClaims

You have to define a PersistentVolume providing disc space to be consumed by the PersistentVolumeClaim. When using storageClass Kubernetes is going to enable “Dynamic Volume Provisioning” which is not working with the local file system. To solve your issue: Provide a PersistentVolume fulfilling the constraints of the claim (a size >= 100Mi) Remove the storageClass … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)