kubectl

Is there anyway to get the external ports of the kubernetes cluster

与世无争的帅哥 提交于 2019-12-02 19:05:00
I have exposed a service on an external port on all nodes in a kubernetes cluster from: kubectl create -f nginx-service.yaml You have exposed your service on an external port on all nodes in your cluster. If you want to expose this service to the external internet, you may need to set up firewall rules for the service port(s) (tcp:30002) to serve traffic. See http://releases.k8s.io/release-1.2/docs/user-guide/services-firewalls.md for more details. service "nginx-service" created.` Is there anyway to get the external ports of the kubernetes cluster? kubectl get svc --all-namespaces -o go

Listing all resources in a namespace

◇◆丶佛笑我妖孽 提交于 2019-12-02 18:56:52
I would like to see all resources in a namespace. Doing kubectl get all will, despite of the name, not list things like services and ingresses. If I know the the type I can explicitly ask for that particular type, but it seems there is also no command for listing all possible types. (Especially kubectl get does for example not list custom types). Any idea how to show all resources before for example deleting that namespace? rcorre Based on this comment , the supported way to list all resources is to iterate through all the api versions listed by kubectl api-resources : kubectl api-resources

Kubernetes sort pods by age

我的梦境 提交于 2019-12-02 17:25:27
I can sort my Kubernetes pods by name using: kubectl get pods --sort-by=.metadata.name How can I sort them (or other resoures) by age using kubectl ? Pods have status, which you can use to find out startTime. I guess something like kubectl get po --sort-by=.status.startTime should work. You could also try: kubectl get po --sort-by='{.firstTimestamp}' . kubectl get pods --sort-by=.metadata.creationTimestamp Thanks @chris Also apparently in 1.7 release sort-by is broken. https://github.com/kubernetes/kubectl/issues/43 Here's the bug report : https://github.com/kubernetes/kubernetes/issues/48602

How to pull environment variables with Helm charts

六眼飞鱼酱① 提交于 2019-12-02 17:04:39
I have my deployment.yaml file within the templates directory of Helm charts with several environment variables for the container I will be running using Helm. Now I want to be able to pull the environment variables locally from whatever machine the helm is ran so I can hide the secrets that way. How do I pass this in and have helm grab the environment variables locally when I use Helm to run the application? Here is some part of my deployment.yaml file ... ... spec: restartPolicy: Always containers: - name: sample-app image: "sample-app:latest" imagePullPolicy: Always env: - name: "USERNAME"

How can I update a secret on Kubernetes when it is generated from a file?

狂风中的少年 提交于 2019-12-02 14:16:41
I've created a secret using kubectl create secret generic production-tls --from-file=./tls.key --from-file=./tls.crt . If I'd like to update the values - how can I do this? Janos Lenart This should work: kubectl create secret generic production-tls \ --from-file=./tls.key --from-file=./tls.crt --dry-run -o yaml | kubectl apply -f - You can delete and immediately recreate the secret: kubectl delete secret production-tls kubectl create secret generic production-tls --from-file=./tls.key --from-file=./tls.crt I put these commands in a script, on the first call you get a warning about the (not yet

`Error: could not find tiller` when running `helm version`

房东的猫 提交于 2019-12-02 13:19:30
I have minikube and kubectl installed: $ minikube version minikube version: v1.4.0 commit: 7969c25a98a018b94ea87d949350f3271e9d64b6 $ kubectl version Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9",

“authenticated as: anonymous Groups that you are in” error when checking kubectl version

流过昼夜 提交于 2019-12-02 10:13:25
I am trying to setup the kubectl tool in my machine to remotely manage Kubernetes cluster and also to use Helm. I am trying in Ubuntu 16.04 machine. I am following the official Kubernetes documentation from the following link, https://kubernetes.io/docs/tasks/tools/install-kubectl/ I ran the following commands, sudo apt-get update && sudo apt-get install -y apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list sudo apt-get update

Kubernetes POD arguments are not passing to service, however Docker arguments are passing correctly

微笑、不失礼 提交于 2019-12-02 07:49:16
Problem Statement: I have a created a Docker image successfully from docker.io/joethecoder2/spring-boot-web . It has been tested with command line arguments, and those work correctly locally with Docker. I am trying to pass java arguments that are passed to Docker to a Kubernetes POD that is defined with a single image docker.io/joethecoder2/spring-boot-web The purpose of passing the arguments is to let the POD know what the IP address and port number are for the database service. Problem Definition: I have defined a Kubernetes POD here, however I believe the arguments are not passed correctly

Kubernetes set image missing resource type 'deployment'

ⅰ亾dé卋堺 提交于 2019-12-02 05:29:44
问题 I'm trying to update an image in Kubernetes by using the following command: kubectl set image deployment/ms-userservice ms-userservice=$DOCKER_REGISTRY_NAME/$BITBUCKET_REPO_SLUG:$BITBUCKET_COMMIT --insecure-skip-tls-verify But when I receive the following error: error: the server doesn't have a resource type "deployment" I have checked that i am in the right namespace, and that the pod with the name exists and is running. I can't find any meaningful resources in regards to this error.

Accessing Kubernetes Web UI (Dashboard)

好久不见. 提交于 2019-12-02 05:29:36
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? The URL you are using to access the dashboard is an endpoint on the API Server. By default, kubeadm deploys the API server on port 6443 , and not on 443 , which is what you would need to access the dashboard through https