kubectl

Restart container within pod

穿精又带淫゛_ 提交于 2019-11-27 17:29:45
I have a pod test-1495806908-xn5jn with 2 containers. I'd like to restart one of them called container-test . Is it possible to restart a single container within a pod and how? If not, how do I restart the pod? The pod was created using a deployment.yaml with: kubectl create -f deployment.yaml Is it possible to restart a single container Not through kubectl , although depending on the setup of your cluster you can "cheat" and docker kill the-sha-goes-here , which will cause kubelet to restart the "failed" container (assuming, of course, the restart policy for the Pod says that is what it

kubectl apply vs kubectl create?

偶尔善良 提交于 2019-11-27 16:48:49
What I understood by the documentation is that kubectl apply = kubectl create + kubectl replace . Reference My understanding is that if I want create new k8s resource in the cluster I should use kubectl create operation. Now If I want to update something in a live k8s resources I should use kubectl replace operation. If I want to do both operations (create a new k8s resource as well as update the live k8s resources ) then I should use kubectl apply operation My questions are Why are there three operations for doing the same task in a cluster? What are the use cases for these operations? How do

Tell when Job is Complete

做~自己de王妃 提交于 2019-11-27 12:20:51
I'm looking for a way to tell (from within a script) when a Kubernetes Job has completed. I want to then get the logs out of the containers and perform cleanup. What would be a good way to do this? Would the best way be to run kubectl describe job <job_name> and grep for 1 Succeeded or something of the sort? abagshaw Since version 1.11, you can do: kubectl wait --for=condition=complete job/myjob and you can also set a timeout: kubectl wait --for=condition=complete --timeout=30s job/myjob Eric Tune You can visually watch a job's status with this command: kubectl get jobs myjob -w The -w option

Define size for /dev/shm on container engine

随声附和 提交于 2019-11-27 10:53:07
问题 I'm running Chrome with xvfb on Debian 8. It works until I open a tab and try to load content. The process dies silently... Fortunately, I have gotten it to run smoothly on my local docker using docker run --shm-size=1G . There is a known bug in Chrome that causes it to crash when /dev/shm is too small. I am deploying to Container engine, and inspecting the OS specs. The host OS has a solid 7G mounted to /dev/shm, but the actual container is only allocated 64M. Chrome crashes. How can I set

How to create a kubectl config file for serviceaccount

旧时模样 提交于 2019-11-27 03:22:59
问题 I have a kubernetes cluster on Azure and I created 2 namespaces and 2 service accounts because I have two teams deploying on the cluster. I want to give each team their own kubeconfig file for the serviceaccount I created. I am pretty new to Kubernetes and haven't been able to find a clear instruction on the kubernetes website. How do I create a kube config file for a serviceaccount? Hopefully someone can help me out :), I rather not give the default kube config file to the teams. With kind

kubectl apply vs kubectl create?

泄露秘密 提交于 2019-11-26 18:44:54
问题 What I understood by the documentation is that kubectl apply = kubectl create + kubectl replace . Reference My understanding is that if I want create new k8s resource in the cluster I should use kubectl create operation. Now If I want to update something in a live k8s resources I should use kubectl replace operation. If I want to do both operations (create a new k8s resource as well as update the live k8s resources ) then I should use kubectl apply operation My questions are Why are there

How kubectl port-forward works?

。_饼干妹妹 提交于 2019-11-26 13:05:57
问题 kubectl expose commands can be used to create a service for the applications and assign an IP address to access it from internet. As far as I understand, to access any application within Kubernetes cluster there should be a service resource created and that should have an IP address which is accessible from external network. But in case of port-forward how kubectl creates an connection to the application without an IP address which is accessible externally? 回答1: kubectl port-forward makes a

Tell when Job is Complete

拟墨画扇 提交于 2019-11-26 12:42:32
问题 I\'m looking for a way to tell (from within a script) when a Kubernetes Job has completed. I want to then get the logs out of the containers and perform cleanup. What would be a good way to do this? Would the best way be to run kubectl describe job <job_name> and grep for 1 Succeeded or something of the sort? 回答1: Since version 1.11, you can do: kubectl wait --for=condition=complete job/myjob and you can also set a timeout: kubectl wait --for=condition=complete --timeout=30s job/myjob 回答2: