google-kubernetes-engine

pod hangs in Pending state

天大地大妈咪最大 提交于 2019-12-11 07:07:40
问题 I have a kubernetes deployment in which I am trying to run 5 docker containers inside a single pod on a single node. The containers hang in "Pending" state and are never scheduled. I do not mind running more than 1 pod but I'd like to keep the number of nodes down. I have assumed 1 node with 1 CPU and 1.7G RAM will be enough for the 5 containers and I have attempted to split the workload across. Initially I came to the conclusion that I have insufficient resources. I enabled autoscaling of

Unable to write file from docker run inside a kubernetes pod

橙三吉。 提交于 2019-12-11 04:21:02
问题 I have a docker image that uses a volume to write files: docker run --rm -v /home/dir:/out/ image:cli args when I try to run this inside a pod the container exit normally but no file is written. I don't get it. The container throw errors if it does not find the volume, for example if I run it without the -v option it throws: Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path '/out/file.txt'. But I don't have any error from the container. It finishes

Kubernetes reports “pod didn't trigger scale-up (it wouldn't fit if a new node is added)” even though it would?

一世执手 提交于 2019-12-11 03:23:08
问题 I don't understand why I'm receiving this error. A new node should definitely be able to accommodate the pod. As I'm only requesting 768Mi of memory and 450m of CPU, and the instance group that would be autoscaled is of type n1-highcpu-2 - 2 vCPU, 1.8GB . How could I diagnose this further? kubectl describe pod: Name: initial-projectinitialabcrad-697b74b449-848bl Namespace: production Node: <none> Labels: app=initial-projectinitialabcrad appType=abcrad-api pod-template-hash=2536306005

kubectl list / delete all completed jobs

依然范特西╮ 提交于 2019-12-11 02:56:37
问题 I'm looking for a kubectl command to list / delete all completed jobs I've try: kubectl get job --field-selector status.succeeded=1 But I get: enfield selector "status.succeeded=1": field label "status.succeeded" not supported for batchv1.Jobter code here What are the possible fields for --fieldSelector when getting jobs ? Is there a better way to do this ? 回答1: What you can do to list all the succeeded jobs is first get all the jobs and then filter the output: kubectl get job --all

how to enable-cors in GKE with ingress

拥有回忆 提交于 2019-12-11 02:33:34
问题 I'm trying to enable cors with ingress without success using the following annotation: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/enable-cors: "true" 回答1: The correct annotation is ingress.kubernetes.io/enable-cors: "true" 回答2: This is a supplement to the approved answer for people using Kubernetes on GCP. If people having an existing ingress running with class gce , they need to switch over to nginx first. Then you should follow the installation steps at NGINX Ingress

Connecting to Google Cloud SQL from Container Engine: can't resolve cloud sql proxy

↘锁芯ラ 提交于 2019-12-11 01:08:57
问题 I'm trying to connect to Google Cloud SQL from a node app, which is running in a Google Container Engine pod managed by Kubernetes. I've followed the instructions here to create a Cloud SQL proxy. When I run the app, I receive: { "code": "ENOTFOUND", "errno": "ENOTFOUND", "syscall": "getaddrinfo", "hostname": "127.0.0.1:3306", "host": "127.0.0.1:3306", "port": 3306, "fatal": true } So it looks as though the proxy can't be resolved. I've run kubectl describe pods <pod_name> and the proxy

Creating an Instance Template in GCE is just hanging

♀尐吖头ヾ 提交于 2019-12-10 20:32:58
问题 Trying to setup a pilot in GCE to try out GKE. I'm trying to create a new instance template from a copy of the one created with by the "gcloud container clusters create" with more space per instance and the create is just hanging??? Is there something obvious that I'm not doing? enter image description here 回答1: It looks like this bug has been fixed. I just copied an instance template for my Google Container Engine cluster in the UI, modified the only the startup script field, and created a

Google Container Engine: Kubernetes is not exposing external IP after creating container

人走茶凉 提交于 2019-12-10 18:19:34
问题 I am trying to create a "Hello Node" sample application in Google Container Engine, following this tutorial However even after running the command kubectl expose rc hello-node --type="LoadBalancer" , it is not exposing an external-IP to access the port. vagrant@docker-host:~/node-app$ kubectl run hello-node --image=gcr.io/${PROJECT_ID}/hello-node:v1 --port=8080 replicationcontroller "hello-node" created vagrant@docker-host:~/node-app$ kubectl expose rc hello-node --type="LoadBalancer" service

How to connect Google Cloud SQL from Google Container Engine?

老子叫甜甜 提交于 2019-12-10 18:14:54
问题 I am using Kubernetes to deploy a Rails application to Google Container Engine . The database is using Google Cloud SQL . I know the database's ip address and set it into my Kubernetes config file: # web-controller.yml apiVersion: v1 kind: ReplicationController metadata: labels: name: web name: web-controller spec: replicas: 2 selector: name: web template: metadata: labels: name: web spec: containers: - name: web image: gcr.io/my-project-id/myapp:v1 ports: - containerPort: 3000 name: http

How can I use curl to access the Kubernetes API from within a pod?

六眼飞鱼酱① 提交于 2019-12-10 17:29:16
问题 I am using Kubernetes 1.8.6 on Google Kubernetes Engine and have a pod running Alpine as part of a StatefulSet . I have logged into my pod using kubectl exec -it my-pod-0 -- /bin/sh and then run the following commands at the prompt: $ CA_CERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt $ TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) $ NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) $ curl --cacert $CA_CERT -H "Authorization: Bearer $TOKEN"