kubectl

Kubernetes pod exec API exception: Response must not include 'Sec-WebSocket-Protocol' header if not present in request

淺唱寂寞╮ 提交于 2019-12-11 05:34:33
问题 I am trying to setup a websocket connection to the Kubernetes Pod Exec API, based on the suggestions given in this SO post: How to execute command in a pod (kubernetes) using API?. Here's what I have done so far - Installed Simple Web Socket Client extension in Chrome. Started kubectl proxy --disable-filter=true to run proxy with WS connections allowed. kubectl.exe version is 1.8. Used address ws://localhost:8001/api/v1/namespaces/default/pods/nginx-3580832997-26zcn/exec?container=nginx&stdin

Kubectl Get Worker Nodes Only

随声附和 提交于 2019-12-11 04:52:07
问题 Is there any shortcut or kubectl command or REST API call to get a list of worker nodes only. ( not including the master nodes ) Update : For the masters we can do like this: kubectl get nodes --selector=node-role.kubernetes.io/master for the workers I dont see any such label created by default. Can we do get by reversing or do != kind of thing on selector. We can't grep it either: C02W84XMHTD5:ucp iahmad$ kubectl get nodes | grep worker C02W84XMHTD5:ucp iahmad$ C02W84XMHTD5:ucp iahmad$

unable to pull public images with kubernetes using kubectl

天大地大妈咪最大 提交于 2019-12-11 04:35:27
问题 I run the following commands and when I check if the pods are running I get the following errors: Failed to pull image "tomcat": rpc error: code = Unknown desc = no matching manifest for linux/amd64 in the manifest list entries kubectl run tomcat --image=tomcat --port 8080 and Failed to pull image "ngnix": rpc error: code = Unknown desc = Error response from daemon: pull access denied for ngnix, repository does not exist or may require 'docker login' kubectl run nginx3 --image ngnix --port 80

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

kubectl : connection refused

帅比萌擦擦* 提交于 2019-12-11 00:44:20
问题 I am on the way of installing minkube 0.19.1 in Ubuntu 16.04 following the kubernetes documentation. As prerequisits I have installed kubectl and Oracle VirtualBox. When I check kubectl with kubectl version it gives following. Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:34:20Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"} The connection to the server

Not able to replace NGINX with NGINX Plus as reverse proxy for microservices on Google Cloud using Kubernetes

…衆ロ難τιáo~ 提交于 2019-12-10 20:11:27
问题 I am following this nice tutorial of How to create a scalable API with micro-services on Google Cloud using Kubernetes. I have created 4 micro-services and to expose the services I am using NGINX Plus. Note : The purpose of NGINX Plus / NGINX here is to work as reverse proxy. Below is the directory Structure : -nginx --Dockerfile --deployment.yaml --index.html --nginx-repo.crt --nginx-repo.key --nginx.conf --svc.yaml Details of files can be seen here. I am pasting the Docker file & nginx.conf

List of Kubernetes status conditions for jobs?

时光怂恿深爱的人放手 提交于 2019-12-10 16:13:24
问题 Is there any resource out there that gives an overview of all the possible status conditions a kubernetes job can have? I'm wondering because I would like to check, when I run a job if it is already running and if so, exit the new job. I came across until kubectl get jobs myjob -o jsonpath='{.status.conditions[?(@.type=="Complete")].status}' | grep True ; do sleep 1 ; done quite a few times but I want to know if it is running, not if it is already complete. Would prefer not to wait (ha) for

Sharing a persistent volume between pods in Kubernetes

╄→尐↘猪︶ㄣ 提交于 2019-12-10 15:58:01
问题 We have two pods in Kubernetes that for sake of conversation we'll call pod1 and pod2. I created pv1 and pvc1 on pod 1 and it's working fine. In my opinion the documentation is not clear enough about this scenario or I couldn't find the right wiki. How can I access pv1 and pc1 from pod2? 回答1: From the k8s documentation: A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator. It is a resource in the cluster just like a node is a cluster

Get the image and SHA image ID of images in pod on Kubernetes deployment

时间秒杀一切 提交于 2019-12-10 13:33:35
问题 How can I get the image ID (the docker sha256 hash) of a image / container within a Kubernetes deployment? 回答1: Something like this will do the trick (you must have jq installed): $ kubectl get pod --namespace=xx yyyy -o json | jq '.status.containerStatuses[] | { "image": .image, "imageID": .imageID }' { "image": "nginx:latest", "imageID": "docker://sha256:b8efb18f159bd948486f18bd8940b56fd2298b438229f5bd2bcf4cedcf037448" } { "image": "eu.gcr.io/zzzzzzz/php-fpm-5:latest", "imageID": "docker:/