You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# init
kubectl create namespace cpu-example
# this sample will be ok
kubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example
kubectl get pod cpu-demo --namespace=cpu-example
kubectl top pod --namespace=cpu-example
kubectl delete pod cpu-demo --namespace=cpu-example
# this won't work as we are exceeding node capacity
kubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example
kubectl describe pod cpu-demo-2 --namespace=cpu-example
kubectl delete pod cpu-demo-2 --namespace=cpu-example
# cleanup
kubectl delete namespace cpu-example
Usage of /stress:
-alsologtostderr
log to standard error as well as files
-cpus int
total number of CPUs to utilize
-log_backtrace_at value
when logging hits line file:N, emit a stack trace (default :0)
-log_dir string
If non-empty, write log files in this directory
-logtostderr
log to standard error instead of files
-mem-alloc-size string
amount of memory to be consumed in each allocation (default "4Ki")
-mem-alloc-sleep duration
duration to sleep between allocations (default 1ms)
-mem-total string
total memory to be consumed. Memory will be consumed via multiple allocations.
-stderrthreshold value
logs at or above this threshold go to stderr
-v value
log level for V logs
-vmodule value
comma-separated list of pattern=N settings for file-filtered logging
Create a new cronjob which runs busybox and the sleep 30 command. Have the cronjob run every three minutes. View the job status to check your work. Change the settings so the pod runs 10 minutes from the current time, every week. For example, if the current time was 2:14PM, I would configure the job to run at 2:24PM, every Monday.
# use helpers to look at the syntax
kubectl create cronjob -h
sleep --help
# create and update the cronjob
kubectl create cronjob test-job --image=busybox --schedule="*/3 * * * *" -- sleep 30s
kubectl get cronjobs
kubectl get cronjob test-job -o yaml
kubectl create job --from=cronjob/test-job singlejob
kubectl get pods
# careful with timezone, Minikube is GMT so 16:33 GMT -> 18:33 CET
kubectl patch cronjob test-job -p '{"spec":{"schedule": "33 16 * * 1"}}'
kubectl delete cronjob test-job