kubectl

Execute bash command in pod with kubectl?

和自甴很熟 提交于 2020-01-12 02:57:12
问题 my question is simple. How to execute a bash command in the pod? I want to do everything with one bash command? [root@master ~]# kubectl exec -it --namespace="tools" mongo-pod --bash -c "mongo" Error: unknown flag: --bash So, the command is simply ignored. [root@master ~]# kubectl exec -it --namespace="tools" mongo-pod bash -c "mongo" root@mongo-deployment-78c87cb84-jkgxx:/# Or so. [root@master ~]# kubectl exec -it --namespace="tools" mongo-pod bash mongo Defaulting container name to mongo.

Accessing Kubernetes Web UI (Dashboard)

随声附和 提交于 2020-01-11 12:50:28
问题 I have installed a Kubernetes with Kubeadm tool, and then followed the documentation to install the Web UI (Dashboard). Kubernetes is installed and running in one node instance which is a taint master node. However, I'm not able to access the Web UI at https://<kubernetes-master>/ui . Instead I can access it on https://<kubernetes-master>:6443/ui . How could I fix this? 回答1: The URL you are using to access the dashboard is an endpoint on the API Server. By default, kubeadm deploys the API

RBAC - Limit access for one service account

与世无争的帅哥 提交于 2020-01-07 06:35:11
问题 I want to limit the permissions to the following service account, created it as follows: kubectl create serviceaccount alice --namespace default secret=$(kubectl get sa alice -o json | jq -r .secrets[].name) kubectl get secret $secret -o json | jq -r '.data["ca.crt"]' | base64 -d > ca.crt user_token=$(kubectl get secret $secret -o json | jq -r '.data["token"]' | base64 -d) c=`kubectl config current-context` name=`kubectl config get-contexts $c | awk '{print $3}' | tail -n 1` endpoint=`kubectl

How to set path to kubectl when installed using gcloud components install?

青春壹個敷衍的年華 提交于 2020-01-04 04:12:11
问题 Ok, I installed kubectl in the following way on my Mac: 1) installed gcloud using homebrew 2) installed kubectl using gcloud components install. I want to run a shell script that calls kubectl directly. However, I get an error. $ kubectl version -bash: kubectl: command not found I expected gcloud components install to set path variables so that I can call kubectl. Looks like that has not happened. I searched for kubectl in my mac but was not able to find it. How can I get kubectl to work from

unable to access DB pod External IP from application

妖精的绣舞 提交于 2020-01-03 05:16:53
问题 I've created two pods top of Azure Kubernetes cluster 1) Application 2) MS SQL server both pods are exposed via Azure Loadbalancer and both having External IPs. I am unable to use the External IP in my application config file. But I can connect that SQL Server from anywhere. For some reason I am unable to telnet DB IP from Application container. the connection is getting timeout. but I can ping/telnet the DB's cluster ip. So I have tried to use the DB cluster IP in my config file to check if

Logs sent to console using logback configuration in java app, not visible in Kubernetes using kubectl logs

拜拜、爱过 提交于 2020-01-02 23:04:50
问题 I read in kubernetes docs somewhere that kubernetes reads application logs from stdout and stderror in pods. I created a new application and configured it to send logs to a remote splunk hec endpoint (using splunk-logback jars) and at the same time to console. So by default, the console logs in logback should go to System.out, which should then be visible using kubectl logs . But it's not happening in my application. my logback file: <?xml version="1.0" encoding="UTF-8"?> <configuration>

ipvsadm not showing any entry in kubeadm cluster

Deadly 提交于 2020-01-02 08:37:09
问题 I have installed kubeadm and created service and pod: packet@test:~$ kubectl get pod NAME READY STATUS RESTARTS AGE udp-server-deployment-6f87f5c9-466ft 1/1 Running 0 5m udp-server-deployment-6f87f5c9-5j9rt 1/1 Running 0 5m udp-server-deployment-6f87f5c9-g9wrr 1/1 Running 0 5m udp-server-deployment-6f87f5c9-ntbkc 1/1 Running 0 5m udp-server-deployment-6f87f5c9-xlbjq 1/1 Running 0 5m packet@test:~$ kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1

Create user in Kubernetes for kubectl

拜拜、爱过 提交于 2020-01-01 08:54:16
问题 I need to create users to assign them permissions with RBAC, I create them as follows: echo -n "lucia" | base64 bHVjaWE= echo -n "pass" | base64 cGFzcw== apiVersion: v1 kind: Secret metadata: name: lucia-secret type: Opaque data: username: bHVjaWE= password: cGFzcw== Or create with: kubectl create secret generic lucia-secret --from-literal=username='lucia',password='pass' I don't know how to continue USER_NICK=lucia kubectl config set-credentials $USER_NICK \ --username=lucia \ --password

Create user in Kubernetes for kubectl

点点圈 提交于 2020-01-01 08:54:07
问题 I need to create users to assign them permissions with RBAC, I create them as follows: echo -n "lucia" | base64 bHVjaWE= echo -n "pass" | base64 cGFzcw== apiVersion: v1 kind: Secret metadata: name: lucia-secret type: Opaque data: username: bHVjaWE= password: cGFzcw== Or create with: kubectl create secret generic lucia-secret --from-literal=username='lucia',password='pass' I don't know how to continue USER_NICK=lucia kubectl config set-credentials $USER_NICK \ --username=lucia \ --password

Wait for kubernetes job to complete on either failure/success using command line

岁酱吖の 提交于 2020-01-01 08:52:50
问题 What is the best way to wait for kubernetes job to be complete? I noticed a lot of suggestions to use: kubectl wait --for=condition=complete job/myjob but i think that only works if the job is successful. if it fails, i have to do something like: kubectl wait --for=condition=failure job/myjob is there a way to wait for both conditions using wait? if not, what is the best way to wait for a job to either succeed or fail? 回答1: kubectl wait --for=condition=<condition name is waiting for a