kubectl

Where are Kubernetes' pods logfiles?

自作多情 提交于 2019-12-31 22:40:34
问题 When I run $ kubectl logs <container> I get the logs of my pods. But where are the files for those logs? Some sources says /var/log/containers/ others says /var/lib/docker/containers/ but I couldn't find my actual application's or pod's log. 回答1: The on-disk filename comes from docker inspect $pod_name_or_sha | jq -r '.[0].LogPath' assuming the docker daemon's configuration is the default {"log-driver": "json-file"} , which is almost guaranteed to be true if kubectl logs behaves correctly.

“authenticated as: anonymous Groups that you are in” error when checking kubectl version

只谈情不闲聊 提交于 2019-12-31 05:46:26
问题 I am trying to setup the kubectl tool in my machine to remotely manage Kubernetes cluster and also to use Helm. I am trying in Ubuntu 16.04 machine. I am following the official Kubernetes documentation from the following link, https://kubernetes.io/docs/tasks/tools/install-kubectl/ I ran the following commands, sudo apt-get update && sudo apt-get install -y apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb https://apt.kubernetes

kubectl: Use custom-columns output with maps

心已入冬 提交于 2019-12-30 11:00:16
问题 I want to get the specific value of an annotation into a kubectl custom columns field. I can get all the current annotations on a resource like so: kubectl get pvc -o custom-columns=NAME:.metadata.name,"ANNOTATIONS":.metadata.annotations -n monitoring This returns a map: NAME ANNOTATIONS prometheus-k8s-db-prometheus-k8s-0 map[pv.kubernetes.io/bind-completed:yes pv.kubernetes.io/bound-by-controller:yes volume.beta.kubernetes.io/storage-provisioner:kubernetes.io/aws-ebs] prometheus-k8s-db

How to Add Users to Kubernetes (kubectl)?

烂漫一生 提交于 2019-12-29 10:16:06
问题 I've created a Kubernetes cluster on AWS with kops and can successfully administer it via kubectl from my local machine. I can view the current config with kubectl config view as well as directly access the stored state at ~/.kube/config , such as: apiVersion: v1 clusters: - cluster: certificate-authority-data: REDACTED server: https://api.{CLUSTER_NAME} name: {CLUSTER_NAME} contexts: - context: cluster: {CLUSTER_NAME} user: {CLUSTER_NAME} name: {CLUSTER_NAME} current-context: {CLUSTER_NAME}

Create kubernetes pod with volume using kubectl run

这一生的挚爱 提交于 2019-12-29 05:05:06
问题 I understand that you can create a pod with Deployment/Job using kubectl run. But is it possible to create one with a volume attached to it? I tried running this command: kubectl run -i --rm --tty ubuntu --overrides='{ "apiVersion":"batch/v1", "spec": {"containers": {"image": "ubuntu:14.04", "volumeMounts": {"mountPath": "/home/store", "name":"store"}}, "volumes":{"name":"store", "emptyDir":{}}}}' --image=ubuntu:14.04 --restart=Never -- bash But the volume does not appear in the interactive

Create kubernetes pod with volume using kubectl run

六眼飞鱼酱① 提交于 2019-12-29 05:04:05
问题 I understand that you can create a pod with Deployment/Job using kubectl run. But is it possible to create one with a volume attached to it? I tried running this command: kubectl run -i --rm --tty ubuntu --overrides='{ "apiVersion":"batch/v1", "spec": {"containers": {"image": "ubuntu:14.04", "volumeMounts": {"mountPath": "/home/store", "name":"store"}}, "volumes":{"name":"store", "emptyDir":{}}}}' --image=ubuntu:14.04 --restart=Never -- bash But the volume does not appear in the interactive

error: You must be logged in to the server (the server has asked for the client to provide credentials)

喜欢而已 提交于 2019-12-25 09:18:30
问题 I am getting this error while running the command "kubectl cluster-info" I am trying this on a google instance and have installed gcloud sdk as well as kubectl on my instance. I have tried running this command I found in a solution earlier:- "sudo sed -i -e 's/true/false/' /usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/config.json" and "gcloud container clusters get-credentials [cluster-name]" still no luck. Please help 来源: https://stackoverflow.com/questions/44457609/error-you-must-be

Difference between --cap-add=NET_ADMIN and add capabilities in .yml

谁都会走 提交于 2019-12-25 01:24:39
问题 i have a question and a problem about capabilities. Why my program work when i run docker run --cap-add=NET_ADMIN ... ? And it's doesn't work if i run my program with file .yml which is: containers: - name: snake image: docker.io/kelysa/snake:lastest imagePullPolicy: Always securityContext: privileged: true capabilities: add: ["NET_ADMIN","NET_RAW"] What is the difference between run docker with --cap-add and run a pod with the same capabilities ? 回答1: As described by David Maze and According

Kubernetes Java API for Kubectl copy command

孤街浪徒 提交于 2019-12-24 21:14:07
问题 I have a container running inside Kubernetes cluster (within POD) along side many other containers (in their own PODs) and my container is a common container. Now, I want to pull (copy) the files from other containers to my common container. I investigated for some options and found that kubectl copy can be used. But, for that, I need to include kubectl command line tool inside my common container. I'm not sure if this is right approach. So, I thought of using Java Kubernetes APIs to do the

Using GKE service account credentials with kubectl

流过昼夜 提交于 2019-12-24 15:39:59
问题 I am trying to invoke kubectl from within my CI system. I wish to use a google cloud service account for authentication. I have a secret management system in place that injects secrets into my CI system. However, my CI system does not have gcloud installed, and I do not wish to install that. It only contains kubectl. Is there any way that I can use a credentials.json file containing a gcloud service account (not a kubernetes service account) directly with kubectl? 回答1: The easiest way to skip