kubectl

kubectl - error: You must be logged in to the server

烈酒焚心 提交于 2019-12-08 02:27:29
问题 I have configured OIDC with k8s installed using kubeadm. After the configuration, when I run the command kubectl --user=name@gmail.com get nodes I get error: You must be logged in to the server (the server has asked for the client to provide credentials (get nodes)) Can someone please help me with this? 回答1: I use kubectl --username=name@gmail.com get nodes and it works. Earlier I was using the parameter --user instead of --username . 回答2: Your password is probably missing. 来源: https:/

Kubernates pass env variable to “kubectl create”

不问归期 提交于 2019-12-07 18:38:27
问题 I need to pass dynamic env variable to kubectl create . Something like this kubectl create -f app.yaml --Target=prod Based on Target code deploys on different servers. 回答1: You can achieve this in two ways: Use Helm. It is a "package manager" for Kubernetes and is built exactly for your use case (dynamic variables to configure behaviour of your resources). If it is only a single variable, "converting" your deployment is as simple as creating a new Helm chart, copy your files into templates/ ,

How to edit a kubernetes resource from a shell script

扶醉桌前 提交于 2019-12-07 10:27:00
问题 I went through the documentation to edit kubernetes resource using kubectl edit command. Once I execute the command, the file in YAML-format is opened in the editor where I can change the values as per requirement and save it. I am trying to execute these steps by means of sed . How can the following steps be achieved? Execute kubectl edit for a deployment resource Set a value from true to false (using sed) Save the changes I tried to achieve this in the following way : $ kubectl edit

K8s Dashboard not logging in (k8s version 1.11)

浪尽此生 提交于 2019-12-07 08:00:27
问题 I did K8s(1.11) cluster using kubeadm tool. It 1 master and one node in the cluster. I applied dashboard UI there. kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml Created service account (followed this link: https://github.com/kubernetes/dashboard/wiki/Creating-sample-user) apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kube-system and apiVersion: rbac.authorization.k8s.io/v1beta1 kind:

Unable to run Kubernetes (kubectl) and Minikube on windows 10. Unable to connect to the server: dial tcp [::1]:8080: connectex:

Deadly 提交于 2019-12-07 05:11:21
Here's the full error Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it. Here's my Kubectl config view apiVersion: v1 clusters: [] contexts: - context: cluster: "" user: "" name: dev current-context: dev kind: Config preferences: {} users: [] I'm running Minikube start . It's stuck on Starting VM... In Hyper-V Manager, I have minikube VM running. Check out " Minikube on Windows 10 with Hyper-V " by Jock Reed The command to run, from a Windows CMD console as Administrator, is: minikube start --vm-driver

kubernetes + coreos cluster - replacing certificates

China☆狼群 提交于 2019-12-07 04:23:24
问题 I have a coreos kubernetes cluster, which I started by following this article: kubernetes coreos cluster on AWS TLDR; > kube-aws init > kube-aws render > kube-aws up Everything worked good and I had a kubernetes coreos cluster on AWS. In the article there is a warning that said: PRODUCTION NOTE: the TLS keys and certificates generated by kube-aws should not be used to deploy a production Kubernetes cluster. Each component certificate is only valid for 90 days, while the CA is valid for 365

Is it possible to access the Kubernetes API via https ingress?

牧云@^-^@ 提交于 2019-12-06 22:56:27
I was trying unsuccessfully access Kubernetes API via HTTPS ingress and now started to wonder if that is possible at all? Any working detailed guide for a direct remote access (without using ssh -> kubectl proxy to avoid user management on Kubernetes node) would be appreciated. :) UPDATE: Just to make more clear. This is bare metal on premise deployment (NO GCE, AWZ, Azure or any other) and there is intension that some environments will be totally offline (which will add additional issues with getting the install packages). Intention is to be able to use kubectl on client host with

kubectl behind a proxy

混江龙づ霸主 提交于 2019-12-06 19:05:12
问题 I have installed a local Kubernetes cluster using minikube following the instructions here. I'm under a corporate proxy. Therefore I have set the http_proxy and https_proxy env vars. Once the cluster is started after minikube start command I also added the value of minikube ip to the no_proxy env var. However still kubectl cannot connect to the cluster. ubuntu@ros-2:~$ kubectl -v=7 get pods I0105 10:31:47.773801 17607 loader.go:354] Config loaded from file /home/ubuntu/.kube/config I0105 10

How to access the Kubernetes API in Go and run kubectl commands

我的未来我决定 提交于 2019-12-06 14:02:20
问题 I want to access my Kubernetes cluster API in Go to run kubectl command to get available namespaces in my k8s cluster which is running on google cloud. My sole purpose is to get namespaces available in my cluster by running kubectl command: kindly let me know if there is any alternative. 回答1: You can start with kubernetes/client-go, the Go client for Kubernetes, made for talking to a kubernetes cluster. (not through kubectl though: directly through the Kubernetes API) It includes a

kubectl run local docker image- ImagePullBackOff status

和自甴很熟 提交于 2019-12-06 07:48:29
问题 i build the docker image on my local machine and trying to pull docker image using kubectl. but its not starting the docker container. images starts with docker command. REPOSITORY TAG IMAGE ID CREATED SIZE tomcat9 latest 8b228ac6f19f About an hour ago 111 MB It stats with ImagePullBackOff massage. $ kubectl get pods NAME READY STATUS RESTARTS AGE tomcat9-511437148-sgkwp 0/1 ImagePullBackOff 0 9m How can I make kubectl to run this docker image? Thanks 回答1: I see from your comments bellow you