kubectl

How can I access to kubernetes dashboard using NodePort in a remote cluster for testing?

天大地大妈咪最大 提交于 2019-12-24 11:14:22
问题 I have a testing Kubernetes cluster running in remote VMs (on VSphere), I have full access to the VMs through ssh (they have private IPs). How can I expose services and access them from outside the cluster (from my remote laptop trying to get access to the machines) knowing that I can remotely perform all kubectl commands. For example: I tried with the dashboard, I installed it, I have changed the service to NodePort, and I tried to access to it from my laptop using this URL http:master

Kubernetes equivalent of 'docker run -it'

久未见 提交于 2019-12-24 10:44:34
问题 I have one docker image and I am using following command to run it. docker run -it -p 1976:1976 --name demo demo.docker.cloud.com/demo/runtime:latest I want to run the same in Kubernetes. This is my current yaml file. apiVersion: v1 kind: Deployment metadata: name: demo-deployment labels: app: demo spec: replicas: 1 selector: matchLabels: app: demo template: metadata: labels: app: demo spec: containers: - name: demo image: demo.docker.cloud.com/demo/runtime:latest ports: - containerPort: 1976

Failed to setup kubeconfig when starting minikube

主宰稳场 提交于 2019-12-24 06:50:00
问题 I have installed kubectl and minikube on my windows environment, but when running minikube start it creates the VM on vitualBox but I got this error when it trying to prepare kubernetes on Docker. C:\Users\asusstrix>minikube start * minikube v1.6.0 on Microsoft Windows 10 Home 10.0.18362 Build 18362 * Selecting 'virtualbox' driver from user configuration (alternates: []) * Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB) ... * Preparing Kubernetes v1.17.0 on Docker '19.03.5' ... *

Stop kubectl from printing “pod curl deleted” at end

北城余情 提交于 2019-12-24 05:57:36
问题 I am using kubectl in a script to get the current GKE cluster name like so: CURRENT_CLUSTER=$(kubectl run curl --rm --restart=Never -it --image=appropriate/curl -- -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/cluster-name) Unfortunately kubect prints pod "curl" deleted to standard output, so the result is this: my-cluster-us-west1pod "curl" deleted How can I stop kubectl from printing this string? 回答1: If there were a space between the

kubernetes statefulsets index/ordinal exposed in template

て烟熏妆下的殇ゞ 提交于 2019-12-24 02:33:37
问题 Statefulsets direct kubectl/kubernetes to create pods with an index or ordinal following the pod name. If the entity has a name of redis for example and the replication count is 3, then we will get redis-0, redis-1 and redis-2. Is there some way to get access to the index or ordinal? It would be very useful to pass to the startup script for a container. It would be nice if it were available in the downward api. It would be really really nice to use it when trying to line up PVC's to PV's. Is

How to wait until Kubernetes list of pods are successful using shell script

不想你离开。 提交于 2019-12-24 00:36:55
问题 I am trying to find a command or a sample shell snippet where I can wait until the list of Kubernetes pods is successful. I have checked the answer but it was not giving any output. Can someone guide me or suggest an approach, I am completely new to kubernetes. kubectl -n test-ns get jobs -w NAME DESIRED SUCCESSFUL AGE test-1 1 1 2d test-2 1 1 2d test-3 1 1 2d test-4 1 1 2d until kubectl get jobs -n test-ns -o jsonpath='{.status.conditions[?(@.type=="Complete")].status}' | grep True ; do

Kubernetes Ingress service can not load static files

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 00:19:00
问题 I have created ingress for some services on minikube (1.8.0): apiVersion: extensions/v1beta1 kind: Ingress metadata: name: gateway-ingress namespace: kube-system annotations: ingress.kubernetes.io/rewrite-target: / spec: rules: - http: paths: - backend: serviceName: api-service servicePort: 80 path: /api paths: - backend: serviceName: kubernetes-dashboard servicePort: 80 path: /ui When I access MINIKUBE_IP/ui, the static files of dashboard not work. Below are errors: 192.168.99.100/:1 GET

AWS EKS add user restricted to namespace

≯℡__Kan透↙ 提交于 2019-12-23 17:30:48
问题 I have created AWS EKS cluster since I have created using my AWS userID has been added to system:masters group. But when checked ConfigMap aws-auth I don't see my user ID. Why ? I had to give access to another user, so I have to assign appropriate AWS policies to the IAM user, then I edited the ConfigMap aws-auth with the following mapping mapUsers: ---- - userarn: arn:aws:iam::573504862059:user/abc-user username: abc-user groups: - system:masters So far I have understood when a user is part

How much RAM can my Kubernetes pod grow to?

*爱你&永不变心* 提交于 2019-12-23 13:38:06
问题 I'd like to know the current limit on the RAM. (No limit/request was explicitly configured.) How do I see the current configuration of an existing pod? [Edit] That configuration would include not only how much memory is now in use, but also the max-limit, the point at which it would be shut down. (If I blow up the heap with huge strings, I see a limit of approx 4 GB, and the Google Cloud Console shows a crash at 5.4 GB (which of course includes more than the Python interpreter), but I don't

How to get cluster id using kubectl command

拈花ヽ惹草 提交于 2019-12-23 06:16:10
问题 I need cluster-id using kubectl command. root@vagrant-xenial64:~# kubectl get cm cluster-info -n kube-system -o jsonpath='{.data.cluster-config\.json}' { "cluster_id": "xxx", "cluster_name": "prod-yyy-mmm", "cluster_type": "rrr", "cluster_pay_tier": "vvv", "datacenter": "cse", "account_id": "456777", "created": "2018-06-32323dffdf:35:48+0000" } I need cluster-id of this particular json root@vagrant-xenial64:~# kubectl get cm cluster-info -n kube-system -o jsonpath='{.data.cluster-config\.json