kubectl

The connection to the server localhost:8080 was refused - did you specify the right host or port?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 04:29:22
when i am trying to test the configuration of kubectl kubectl get svc i am getting this error: the server doesn't have a resource type "svc" when I try this command kubectl get services i am getting error:The connection to the server localhost:8080 was refused - did you specify the right host or port? and i am following this userguide to deploy a kubernetes application on my mac https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-create-cluster Admins-MacBook-Pro:~ Harshin$ kubectl version --short --client Client Version: v1.10.3 please help me!! Hareesh R Make a copy of

Create kubernetes pod with volume using kubectl run

*爱你&永不变心* 提交于 2019-11-29 01:20:23
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 bash. Is there a better way to create a pod with volume that you can attach to? Your JSON override is

Kubernetes create deployment unexpected SchemaError

十年热恋 提交于 2019-11-28 20:45:50
问题 I'm following that tutorial (https://www.baeldung.com/spring-boot-minikube) I want to create Kubernetes deployment in yaml file (simple-crud-dpl.yaml): apiVersion: apps/v1 kind: Deployment metadata: name: simple-crud spec: selector: matchLabels: app: simple-crud replicas: 3 template: metadata: labels: app: simple-crud spec: containers: - name: simple-crud image: simple-crud:latest imagePullPolicy: Never ports: - containerPort: 8080 but when I run kubectl create -f simple-crud-dpl.yaml i got:

Define size for /dev/shm on container engine

别等时光非礼了梦想. 提交于 2019-11-28 18:23:05
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 the size of /dev/shm when using kubectl to deploy to container engine? Mounting an emptyDir to /dev/shm

Kubernetes pod gets recreated when deleted

試著忘記壹切 提交于 2019-11-28 18:04:40
I have started pods with command # kubectl run busybox --image=busybox --restart=Never --tty -i --generator=run-pod/v1 Something went wrong, and now I can't delete this pod I tried using below methods but it keeps recreating itself # kubectl delete pods busybox-na3tm pod "busybox-na3tm" deleted # kubectl get pods NAME READY STATUS RESTARTS AGE busybox-vlzh3 0/1 ContainerCreating 0 14s # kubectl delete pod busybox-vlzh3 --grace-period=0 # kubectl delete pods --all pod "busybox-131cq" deleted pod "busybox-136x9" deleted pod "busybox-13f8a" deleted pod "busybox-13svg" deleted pod "busybox-1465m"

How to create a kubectl config file for serviceaccount

余生颓废 提交于 2019-11-28 10:09:42
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 regards, Bram # your server name goes here server=https://localhost:8443 # the name of the secret

coredns pods have CrashLoopBackOff or Error state

帅比萌擦擦* 提交于 2019-11-28 01:50:38
问题 I'm trying to set up the Kubernetes master, by issuing: kubeadm init --pod-network-cidr=192.168.0.0/16 followed by: Installing a pod network add-on (Calico) followed by: Master Isolation issue: coredns pods have CrashLoopBackOff or Error state: # kubectl get pods -n kube-system NAME READY STATUS RESTARTS AGE calico-node-lflwx 2/2 Running 0 2d coredns-576cbf47c7-nm7gc 0/1 CrashLoopBackOff 69 2d coredns-576cbf47c7-nwcnx 0/1 CrashLoopBackOff 69 2d etcd-suey.nknwn.local 1/1 Running 0 2d kube

kubectl YAML config file equivalent of “kubectl run … -i --tty …”

你。 提交于 2019-11-27 23:28:28
问题 I've been using "kubectl run" with assorted flags to run Jobs interactively, but have recently outgrown what I can do with those flags, and have graduated to using YAML config files to describe my jobs. However, I can't find an equivalent to the "-i" and "--tty" flags, to attach to the Job I'm creating. Is there an equivalent YAML spec for: kubectl run myjob \ -i \ --tty \ --image=grc.io/myproj/myimg:mytag \ --restart=Never \ --rm \ -- \ my_command Or is this maybe not the right approach? 回答1

How to format the output of kubectl describe to JSON

冷暖自知 提交于 2019-11-27 23:23:53
问题 kubectl get command has this flag -o to format the output. Is there a similar way to format the output of the kubectl describe command? For example: kubectl describe -o="jsonpath={...}" pods my-rc would print a JSON format for the list of pods in my-rc replication controller. But -o is not accepted for the describe command. 回答1: kubectl describe doesn't support -o or equivalent. It's meant to be human-readable rather than script-friendly. You can achieve what you described with kubectl get

Kubernetes pod gets recreated when deleted

那年仲夏 提交于 2019-11-27 19:59:04
问题 I have started pods with command $ kubectl run busybox --image=busybox --restart=Never --tty -i --generator=run-pod/v1 Something went wrong, and now I can't delete this Pod . I tried using the methods described below but the Pod keeps being recreated. $ kubectl delete pods busybox-na3tm pod "busybox-na3tm" deleted $ kubectl get pods NAME READY STATUS RESTARTS AGE busybox-vlzh3 0/1 ContainerCreating 0 14s $ kubectl delete pod busybox-vlzh3 --grace-period=0 $ kubectl delete pods --all pod