prompt
stringlengths
65
38.7k
response
stringlengths
41
29.1k
<p>This describes how one would install the agent on a regular gce instance: <a href="https://cloud.google.com/monitoring/agent/install-agent" rel="nofollow noreferrer">https://cloud.google.com/monitoring/agent/install-agent</a></p> <p>Previously the cluster ran on debian os nodes and we'd have the agent running to mo...
<p>I've ran into the same thing several times. You have to switch back to the <code>container-vm</code> format in order to install the stackdriver agent.</p> <p><code>gcloud container clusters upgrade --image-type=container_vm [CLUSTER_NAME]</code> </p> <p>That should flip it back. You can install the agent once the ...
<p>I'm new to Openshift/k8s. The docker image I'm running in openshift is using USER blabla. But when I exec into the pod, it use a different rather than the one in Dockerfile.</p> <p>I'm wondering why? and how can I work around this ?</p> <p>Thanks</p>
<p>For security, cluster administrators have the option to force containers to run with cluster assigned uids. By default, most containers run using a uid from a range assigned to the project. </p> <p>This is controlled by the configured <a href="https://docs.openshift.org/latest/admin_guide/manage_scc.html" rel="nofo...
<p>Some info:</p> <ul> <li>Kubernetes (1.5.1)</li> <li>AWS</li> <li>1 master and 1 node (both ubuntu 16.04)</li> <li>k8s installed via kubeadm</li> <li>Terraform made by me</li> </ul> <p>Please don't reply use kube-up, kops or similar. This is about understanding how k8s works under the hood. There is by far too much...
<p>I think Steve is on the right track. Make sure your kubelets, apiserver, and controller-manager components all include <code>--cloud-provider=aws</code> in their arguments lists.</p> <p>You mention your subnets and instances all have matching <code>KubernetesCluster</code> tags. Do your controller &amp; worker secu...
<p>So I built my Kubernetes cluster on AWS using <a href="https://github.com/kubernetes/kops/blob/master/docs/aws.md" rel="nofollow noreferrer">KOPS</a></p> <p>I then deployed SocketCluster on my K8s cluster using <a href="https://docs.baasil.io/deploying_your_app_to_your_kubernetes_cluster.html" rel="nofollow norefer...
<p>The answer is here <a href="https://github.com/kubernetes/kops/tree/master/addons/ingress-nginx" rel="nofollow noreferrer">https://github.com/kubernetes/kops/tree/master/addons/ingress-nginx</a></p> <p>kubectl apply -f <a href="https://raw.githubusercontent.com/kubernetes/kops/master/addons/ingress-nginx/v1.4.0.yam...
<p>I am trying to learn docker and kubernetes and one of the things I am trying to do is setup Redis with Sentinel and expose redis to things outside the container. </p> <p>Getting redis and sentinel setup was pretty easy following <a href="https://github.com/kubernetes/kubernetes/tree/master/examples/storage/redis" ...
<p>The redis sentinel service file from your link (<a href="https://github.com/kubernetes/kubernetes/blob/master/examples/storage/redis/redis-sentinel-service.yaml" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/blob/master/examples/storage/redis/redis-sentinel-service.yaml</a>) will expose the pods...
<p>Very simple question, where is the <code>emptyDir</code> located in my minikube VM? Since the <code>emptyDir</code> volume is pod dependent, it should exist on the VM otherwise it will die with a container exiting. When I do <code>minikube ssh</code> I cannot locate the volume. I need to inspect it and see if my co...
<p>A better way to see if your containers are behaving is by logging in into the container using the kubectl command. </p> <p>That said: The location should of <strong>emptyDir</strong> should be in <strong>/var/lib/kubelet/pods/{podid}/volumes/kubernetes.io~empty-dir/</strong> on the given node where your pod is runn...
<p>I'd like to deploy kubernetes on a large physical server (24 cores) and I'm uncertain as to a number of things.</p> <p>What are the pros and cons of creating virtual machines for the k8s cluster other than running on bare-metal.</p> <p>I have the following considerations:</p> <ul> <li>Creating vms will allow for ...
<p>I would separate dev and prod in the form of different vms. I once had a webapp inside docker which used too many threads so the docker daemon on the host crashed. It was limited to one host luckily. You can protect this by setting limits, but it's a risk: one mistake in dev could bring down prod as well. </p>
<p>On my local I run a <code>mysql</code> container and then ping it from another container on the same network:</p> <pre><code>$ docker run -d tutum/mysql $ docker run -it plumsempy/plum bash # ping MYSQL_CONTAINER_ID PING 67e35427d638 (198.105.244.24): 56 data bytes 64 bytes from 198.105.244.24: icm...
<p>From <a href="http://kubernetes.io/docs/user-guide/pods/multi-container/" rel="nofollow noreferrer">k8s multi-container pod docs</a>:</p> <blockquote> <p>Pods share fate, and share some resources, such as storage volumes and IP addresses.</p> </blockquote> <p>Hence the <code>mysql</code> container is reachable f...
<p>I have a simple cluster set up with just a single master for the time being running CoreOS. I have the kubelet running using the kubelet-wrapper script from CoreOS and I'm running weave for the pod network.</p> <p>The API server, controller manager, and scheduler are all running using systemd units properly with ho...
<p>I've run into this myself, and it's more of a CoreOS bug I think.</p> <p>CoreOS uses a network daemon for managing network interfaces, but in some cases (like here) you want to manage some interfaces yourself. And CNI is broken here on CoreOS, because networkd tries to manage the CNI interface and the Weave interfa...
<p>I'm setting up a sample Kubernetes cluster in my laptop using virtual box vm's. Using flannel as the overlay network. I have successfully created a master and a node. When I spin up a pod in the node to deploy a mongodb container, the pod and container is deployed successfully with endpoints. Service also created su...
<p><strong>TL;DR:</strong> you cannot connect from the master to the service as it is, you have to create a <code>NodePort</code> service and then, use the <code>NodePort</code> given to connect.</p> <p>Look at the service description:</p> <pre><code>[osboxes@kubemaster pods]$ kubectl describe svc mongoservice Name:...
<p>Does Kubernetes have the ability/need to hook into a cloud provider (AWS, Rackspace) to spin up new nodes? If so, how does it then provision the node - does it run Ansible etc? Or will Kubernetes need to have all the nodes available to it manually?</p>
<p>The short answer is no.</p> <p>The longer answer is explained in the following blog posting that describes the new <a href="http://kubernetes.io/docs/getting-started-guides/kubeadm/" rel="nofollow noreferrer">kubeadm</a> command:</p> <p><a href="http://blog.kubernetes.io/2016/09/how-we-made-kubernetes-easy-to-inst...
<p>The new ability to specify a HEALTHCHECK in a Dockerfile seems redundant with the Kubernetes probe directives. Any advice on what to use when?</p>
<p>If you use Kubernetes, I'd suggest using only the Kubernetes liveness/readiness checks because Docker healthcheck <a href="https://github.com/kubernetes/kubernetes/issues/25829" rel="noreferrer">has not been integrated in the Kubernetes</a> as of now (release 1.12). This means that Kubernetes does not expose the che...
<p>I have installed a local Kubernetes cluster using minikube following the instructions <a href="http://kubernetes.io/docs/getting-started-guides/minikube/" rel="noreferrer">here</a>.</p> <p>I'm under a corporate proxy. Therefore I have set the http_proxy and https_proxy env vars. Once the cluster is started after <c...
<p>Fixed this. The fix was to have the no_proxy details in NO_PROXY as well.</p> <pre><code>export NO_PROXY=$no_proxy,$(minikube ip) </code></pre> <p><a href="https://github.com/kubernetes/minikube/issues/530" rel="noreferrer">Relevant thread</a>. Hope this will be useful to someone.</p>
<p>I'm using Kops 1.4.4 to launch my Kubernetes cluster on AWS. My Elasticsearch pods require me to set the kernel parameter <code>vm.max_map_count</code> to at least 262144. Kubernetes 1.5.1 has systctl feature, but it requires Docker >= 1.12. Kops currently builds my nodes with a lesser Docker version and so I'm stuc...
<p>Apparently this can be done using <a href="http://kubernetes.io/docs/user-guide/production-pods/#handling-initialization" rel="nofollow noreferrer">Kubernetes init containers</a>. Following the Kubernetes deployment config posted <a href="https://github.com/giantswarm/kubernetes-elastic-stack/blob/c8cda9e8efc1e33eb3...
<p>I'm experimenting with Cassandra and Redis on Kubernetes, using <a href="https://github.com/kubernetes/kubernetes/tree/v1.5.1/examples/storage/cassandra#step-2-use-a-statefulset-to-create-cassandra-ring" rel="nofollow noreferrer">the examples for v1.5.1</a>.</p> <ul> <li>With a Cassandra StatefulSet, if I shutdown ...
<p>Please refer to the documentation <a href="http://kubernetes.io/docs/tasks/manage-stateful-set/delete-pods/#deleting-pods" rel="nofollow noreferrer">here</a>.</p> <blockquote> <p>Kubernetes (versions 1.5 or newer) will not delete Pods just because a Node is unreachable. The Pods running on an unreachable Node e...
<p>I am getting error message in /var/log/messages when tried to setup the cluster with the command "kubeadm init":</p> <pre><code>e4dad33)": pods "kube-scheduler-master" already exists Jan 3 21:28:45 master kubelet: I0103 21:28:45.777830 8726 kubelet_node_status.go:204] Setting node annotation to enable volume co...
<p>You just have to install a (3rd party) Pod Network of some kind, like stated in the guide.</p> <p>Personally, I'm using Weave or Flannel. You can for example install Weave this way:</p> <pre><code>kubectl apply -f https://git.io/weave-kube </code></pre> <p>That said, there are many other Pod Network providers as ...
<p>I am new to Google Container Engine (GKE). When run on <code>localhost</code> it's working fine but when I deploy to production with GKE I got websocket error.</p> <p>My node app is develop with <code>Hapi.js</code> and <code>Socket.io</code> and my structure is shown in image below.</p> <p><a href="https://i.stac...
<p>After I update Kubernetes service template to use <code>sessionAffinity: ClientIP</code> it works now. But just get some error when first press <code>Ctrl + F5</code> and on second press it's work fine.</p> <pre><code>Error during WebSocket handshake: Unexpected response code: 400 </code></pre> <p><strong>However,...
<p>I'm playing with Google container engine on gcloud. So after successfully finished <code>gloud init</code> I followed instructions and did:</p> <pre><code>gcloud container clusters get-credentials cluster-1 --zone europe-west1-c --project whatever </code></pre> <p>And then:</p> <pre><code>kubectl proxy </code></p...
<p>Use</p> <pre><code>gcloud auth application-default login </code></pre> <p>to login for application default creadentials (<a href="https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login" rel="noreferrer">docs</a>). The behavior for application default credentials has <a href="https://cloud.goo...
<p><strong>Question 1</strong> - I'm reading the documentation and I'm slightly confused with the wording. It says:</p> <blockquote> <p><strong>ClusterIP</strong>: Exposes the service on a cluster-internal IP. Choosing this value makes the service only reachable from within the cluster. This is the default ServiceType<...
<p>A ClusterIP exposes the following:</p> <ul> <li><code>spec.clusterIp:spec.ports[*].port</code></li> </ul> <p>You can only access this service while inside the cluster. It is accessible from its <code>spec.clusterIp</code> port. If a <code>spec.ports[*].targetPort</code> is set it will route from the port to the targ...
<p>just going through this guide on gitlab and k8s <a href="https://about.gitlab.com/2016/12/14/continuous-delivery-of-a-spring-boot-application-with-gitlab-ci-and-kubernetes/" rel="nofollow noreferrer">gitlab-k8s-cd</a>, but my build keeps failing on this part:</p> <pre><code>- kubectl delete secret registry.gitlab.c...
<p><strong>Regarding your first error:</strong></p> <p>Ports are defined differently in Kubernetes than in Docker or Docker Compose. This is how the port specification should look like:</p> <pre><code>ports: - containerPort: 8080 hostPort: 80 </code></pre> <p>See the <a href="http://kubernetes.io/docs/api-refe...
<p>I want to find out which version of kubernetes code I am reading. It spend too much time to build the source code.</p>
<p>I don't entirely follow your question. If you're building from source, it's not necessary that you're on a given version at all. You're a lot more likely to be "between" versions.</p> <p>Your best bet is to look at</p> <pre><code>git describe --exact-match --abbrev=0 </code></pre> <p>It will give you the latest t...
<p>This may sound like a n00b question, and maybe it is, but some things with the Azure Container Services puzzle me a little. I have managed to get a Kubernetes Cluster up and running on Azure inside a Resource Group, so for starters I am set and done.</p> <p>Now my questions are the following:</p> <ul> <li>Who will...
<p>I'm on the Azure Container Service team, and your statement:</p> <p>"ACS is just a set of Resource Manager Templates"</p> <p>Is more or less correct at this moment in time (Jan. 2017)</p> <p>Over the course of the next few months, we will be improving support for all of the scenarios you mentioned: * Backup *...
<p>I have successfully set up a Kubernetes cluster on my VMware host using Rancher. I have the kubernetes-dashboard running and can execute commands to the cluster using kubectl. </p> <p>Now, I want to deploy my application to the cluster using a SaaS build tool (Distelli). This build tool should connect to my host us...
<p>You need to have a route from the public internet to the API server. This can be accomplished by assigning a public IP direct to the machine running the api server, or you could have a load balancer direct traffic in as well. You mentioned you were on VMWare so there could be a couple different paths depending on yo...
<p>I have a 3x node kubernetes cluster: node1 (master), node2, and node3. I have a pod that's currently scheduled on node3 that I'd like to be exposed externally to the cluster. So I have a service of type nodePort with the nodePort set to 30080. I can successfully do <code>curl localhost:30080</code> locally on eac...
<p>I found the cause of why the service couldn't be reached externally. It was because iptables FORWARD chain was dropping the packets. I raised an issue with kubernetes at <a href="https://github.com/kubernetes/kubernetes/issues/39658" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/39658</...
<p>I've got a setup described bellow - so a simple replication controller, service and an https ingress deployed with kubernetes on google cloud.</p> <p>I need to kill my app for a bit so that I can test how the rest of my stack reacts - what's a good way to do it?</p> <p>I've tried deleting the service, but when I'v...
<p>You could set the replica count to 0 for the duration of the test. When you're finished testing, you would reset the replica count to the desired number to bring your app back up.</p> <p>The command to do this would be</p> <pre><code>$ kubectl scale rc nodeapp-https --replicas=0 ... do your test $ kubectl scale rc...
<p>I'm using the PersistentVolume functionality for sharing VM directories with Pods. For example:</p> <pre><code>apiVersion: v1 kind: PersistentVolume metadata: name: psql-data-disk spec: accessModes: - ReadWriteOnce capacity: storage: 1Gi hostPath: path: /data/psqldata </code></pre> <p>But I can...
<p>Ugh, I hadn't known about the <code>minikube ssh</code> command to get into the VM. So I just went in there and deleted the directory.</p>
<p>I have kube service running with 2 named ports like this:</p> <pre><code>$ kubectl get service elasticsearch --output json { "apiVersion": "v1", "kind": "Service", "metadata": { ... stuff that really has nothing to do with my question ... }, "spec": { "clusterIP": "10.0.0.174", ...
<p><code>(</code> and <code>)</code> mean something in bash (see <a href="http://www.gnu.org/software/bash/manual/html_node/Command-Grouping.html" rel="noreferrer">subshell</a>), so your shell interpreter is doing that first and getting confused. Wrap the argument to <code>jsonpath</code> in single quotes, that will f...
<p>I'm pretty new to Kubernetes and clusters so this might be very simple.</p> <p>I set up a Kubernetes cluster with 5 nodes using <code>kubeadm</code> following <a href="http://kubernetes.io/docs/getting-started-guides/kubeadm/" rel="noreferrer">this guide</a>. I got some issues but it all worked in the end. So now I...
<p>in <code>/etc/kubernetes/manifests</code> is a file called <code>kube-apiserver.json</code>. This is a JSON file and contains all the option you can set. I've appended the <code>--basic-auth-file=SOMEFILE</code> and rebooted the system (right after the change of the file <code>kubectl</code> wasn't working anymore a...
<p>I'm setting up a kubernetes cluster with many different components for our application stack and I'm trying to balance storage requirements while minimizing the number of components.</p> <p>We have a web <strong>scraper</strong> that downloads tens of thousands of HTML files (and maybe PDFs) every day and I want to ...
<p>Are you in a cloud? If in AWS S3 would be a good spot, object storage sounds like what you might want, but not sure of your requirements. </p> <p>If not in a cloud, you could run Minio (<a href="https://www.minio.io/" rel="nofollow noreferrer">https://www.minio.io/</a>) which would give you the same type of object ...
<p>I have a kubernetes + flannel setup. Flannel config is <code>{"Network": "10.200.0.0/16", "SubnetLen":24, "Backend": {"Type": "vxlan"}}</code>.</p> <p>I started the apiserver with <code>--service-cluster-ip-range=10.32.0.0/24</code>. As I understand, pods addresses are managed by flannel and service-cluster-ip-rang...
<p>adding <code>--masquerade-all</code> flag to kube-proxy, solved this for me. It seems that iptables is not masquerading the requests without this flag which causes dns lookup to fail.</p>
<p>Considering other orchestration tools like <a href="https://github.com/dokku/dokku" rel="noreferrer">dokku</a>, dcos, deis, <a href="https://github.com/flynn/flynn" rel="noreferrer">flynn</a>, docker swarm, etc.. Kubernetes is no where near to them in terms of lines of code, on an average those tools are around 100k...
<p><strong>First and foremost</strong>: don't be misled by the number of lines in the code, most of it are dependencies in the <code>vendor</code> folder that does not account for the core logic (<em>utilities, client libraries, gRPC, etcd,</em> etc.).</p> <h2>Raw LoC Analysis with cloc</h2> <p><em>To put things into...
<p>I have just installed a basic kubernetes cluster the manual way, to better understand the components, and to later automate this installation. I followed this guide: <a href="https://kubernetes.io/docs/getting-started-guides/centos/centos_manual_config/" rel="noreferrer">https://kubernetes.io/docs/getting-started-gu...
<p>Experimenting with kubedns arguments, I added <code>--kube-master-url=http://mykubemaster.mydomain:8080</code> to the yaml file, and suddenly it reported in green. </p> <p>How did this solve it? Was the container not aware of the master for some reason?</p>
<p>I'm new to openshift and k8s. I'm not sure what's the difference between these two terms, openshift route vs k8s ingress ?</p>
<p>Ultimately they are intended to achieve the same end. Originally Kubernetes had no such concept and so in OpenShift the concept of a <code>Route</code> was developed, along with the bits for providing a load balancing proxy etc. In time it was seen as being useful to have something like this in Kubernetes, so using ...
<p>I've used Kubeadm to bootstrap a cluster, and added weave-net with</p> <p><code>kubectl apply -f https://git.io/weave-kube</code></p> <p>and I have everything running, but I can't "see" any of the assigned IP's within the cluster. </p> <p>So:</p> <p><code>[centos@atomic01 ~]$ kubectl get pods --all-namespaces -o...
<p>Hmm, does any of the test or hello Pods expose any ports? Can you access a port on the hello pod from the test pod?</p> <p>Normally, I don't think ping should work (unless you have a Pod that processes icmp requests), so I actually don't think there's anything wrong here.</p> <p>Just run a Pod (preferably from a D...
<p>I want to watch the change of namespaces in kubernetes cluster, with code like:</p> <pre><code> log.Infoln(&quot;====== 1 ======= &quot;) namespaces, err := clientset.Namespaces().List(api.ListOptions{Watch: true}) if err != nil { log.Errorln(&quot;Get namespaces from kubernetes cl...
<p>I had foud the answer:</p> <pre><code>var watch watch.Interface if watch, err = clientset.Namespaces().Watch(api.ListOptions{Watch: true}); err != nil { log.Errorln("Watch namespaces from kubernetes cluster error:%v", err) return } eventChan := watch.ResultChan() for event := range eventChan { log.Info...
<p>Many applications require configuration via some combination of config files, command line arguments, and environment variables. These configuration artifacts should be decoupled from image content in order to keep containerized applications portable. The ConfigMap API resource provides mechanisms to inject containe...
<p><a href="https://kubernetes.io/docs/user-guide/configmap/" rel="nofollow noreferrer">ConfigMaps</a> in Kubernetes can be consumed in many different ways and mounting it as a volume is one of those ways.</p> <p>You can choose where you would like to mount the ConfigMap on your Pod. Example from K8s documentation:</p...
<p>I have simple ingress for virtual hosting:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Ingress metadata: name: ingress-access spec: rules: - host: service1.domain.com http: paths: - backend: serviceName: service1 servicePort: 80 - host: service2.domain.com ...
<p><a href="https://github.com/kubernetes/ingress-gce/blob/master/docs/faq/gce.md" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-gce/blob/master/docs/faq/gce.md</a></p> <p>It seems that the correct answer is that Ingress requires NodePort to work with, so services should have <code>NodePort</code> typ...
<p>How do I get a pod's name from its IP address? What's the magic incantation of <code>kubectl</code> + <code>sed</code>/<code>awk</code>/<code>grep</code>/etc regardless of where <code>kubectl</code> is invoked?</p>
<h3>Example:</h3> <pre><code>kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE alpine-3835730047-ggn2v 1/1 Running 0 5d 10.22.19.69 ip-10-35-80-221.ec2.internal </code></pre> <h3>get pod name by IP</h3> <pre><...
<p>I set up a Kubernetes cluster. Apiserver is started on host 192.168.0.2, and I use self-signed certificate and static token as authentication. The other 2 nodes' ip are 192.168.0.3 and 192.168.0.4</p> <p>Then I created a prometheus deployment, the config is <a href="https://raw.githubusercontent.com/prometheus/prom...
<p>That sounds like a network issue as the request is timing out. Can you hit that endpoint from inside the Prometheus container?</p>
<p>I am new to K8s and this is my first time trying to get to grips with it. I am trying to set up a basic Nodejs Express API using this deployment.yml:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: api spec: replicas: 1 template: metadata: labels: app: api ...
<p>I have looked into it again and think I figured it out.</p> <p>In order for Ingress to work on GCE you need to define your backend service das a <code>NodePort</code> not as ClusterIP or LoadBalancer.</p> <p>Also you need to make sure the http health check to <code>/</code> works (you'll see the Google L7 Loadbala...
<p>DaemonSet is a Kubernetes beta resource that can ensure that exactly one pod is scheduled to a group of nodes. The group of nodes is all nodes by default, but can be limited to a subset using nodeSelector or the Alpha feature of node affinity/anti-affinity.</p> <p>It seems that DaemonSet functionality can be achiev...
<p>As you said, DaemonSet guarantees one pod per node for a subset of the nodes in the cluster. If you use ReplicaSet instead, you need to</p> <ol> <li>use the node affinity/anti-affinity and/or node selector to control the set of nodes to run on (similar to how DaemonSet does it).</li> <li>use <a href="https://kubern...
<p>I am following this <a href="https://kubernetes.io/docs/getting-started-guides/centos/centos_manual_config/" rel="nofollow noreferrer">tutorial</a> with 2 vms running CentOS7. Everything looks fine (no errors during installation/setup) but I can't see my nodes.</p> <p>NOTE: </p> <ul> <li>I am running this on VMWar...
<p>My issue was that the <code>KUBELET_HOSTNAME</code> on <code>/etc/kubernetes/kubeletvalue</code> didn't match the hostname.</p> <p>I commented that line, then restarted the services and I could see my worker after that.</p> <p>hope that helps</p>
<h2>Problem</h2> <p>Hi I recently deployed csanchez's jenkins-kubernetes build on a local kubernetes build (<a href="https://github.com/jenkinsci/kubernetes-plugin" rel="nofollow">https://github.com/jenkinsci/kubernetes-plugin</a>). This also means I used the provided jenkins-local.yml and service-local.yml. The buil...
<p>There is additional configuration needed for Jenkins to spawn agents ASAP, see <a href="https://github.com/jenkinsci/kubernetes-plugin#over-provisioning-flags" rel="nofollow noreferrer">https://github.com/jenkinsci/kubernetes-plugin#over-provisioning-flags</a></p> <p>In short add Jenkins startup parameters</p> <pr...
<p>I am new to K8s and this is my first time trying to get to grips with it. I am trying to set up a basic Nodejs Express API using this deployment.yml:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: api spec: replicas: 1 template: metadata: labels: app: api ...
<p><strong>Thought I would post my working deployment/service/ingress</strong></p> <p>So after much effort in getting this working, here is what I used to get it working:</p> <p><strong>Deployment</strong></p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: backend-api-v2 spec: replica...
<p>I built a kubernetes cluster through kubeadm and created several services. These services can be accessed externally through the node ip: port, but when I try to access the service through cluster ip, it fails, it displays the error message curl: (7) Failed connect to 10.99.237.89:2379; Connection timed out, this Ho...
<p>Cluster IPs are not accessible from outside the cluster, they are internal only.</p> <p>See <a href="https://kubernetes.io/docs/user-guide/services/#publishing-services---service-types" rel="nofollow noreferrer">here</a> for more details</p>
<p>I can't find the syntax on how to do it. How can I do TCP health checks on containers inside a pod?</p>
<p>You can do it with the tcpSocket definition:</p> <pre><code>livenessProbe: tcpSocket: port: 9000 initialDelaySeconds: 120 timeoutSeconds: 5 readinessProbe: tcpSocket: port: 9000 initialDelaySeconds: 120 timeoutSeconds: 5 </code></pre>
<p>I went through both <a href="https://stackoverflow.com/questions/36407449/daemonset-doesnt-create-any-pods">daemonset doesn&#39;t create any pods</a> and <a href="https://stackoverflow.com/questions/34818198/daemonset-doesnt-create-any-pods-v1-1-2">DaemonSet doesn&#39;t create any pods: v1.1.2</a> before asking this...
<p>I found the solution after studying <a href="https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/fluentd-elasticsearch/fluentd-es-ds.yaml" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/fluentd-elasticsearch/fluentd-es-ds.yaml</a> </p> <p>There is <code...
<p>I am trying to create a Kubernetes cluster with Vagrant using an Ansible playbook that works perfectly on real (linux) servers. I am having a problem with the <code>kubeadm join</code> with vagrant.</p> <p>I am using the following command to join a node to the cluster.</p> <pre><code>kubeadm join --token={{ kube_t...
<p>you can use <code>hostvars[groups['kubemaster'][0]].ansible_eth1.ipv4.address</code> assuming that your eth1 is your actual ip you want. as noted by Frederic, it uses the default as the first. you can do <code>ip addr</code> to find your interfaces on a machine. </p>
<p>I want to run k8s-visualizer for Kubernetes in der Google Cloud Platform. Just found how to run it local. </p> <p>How to run it in the Google Cloud Platform?</p> <p><a href="https://i.stack.imgur.com/idLaH.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/idLaH.gif" alt="enter image description he...
<p>The <a href="https://github.com/saturnism/gcp-live-k8s-visualizer.git" rel="nofollow noreferrer">k8s-visualizer</a> is written in a way that it depends on the <code>kubectl proxy</code> and runs all Ajax calls against <code>/api/...</code>. It isn't ready to run on the cluser.</p> <p>If you want to have it on your ...
<p>As in title. I want to clone (create a copy of existing cluster).</p> <p>If it's not possible to copy/clone Google Container Engine cluster, then how to clone Kubernetes cluster?</p> <p>If that's not possible, is there a way to dump the whole cluster config?</p> <h3>Note:</h3> <p>I try to modify the cluster's co...
<p>I'm using a bash script from CoreOS team, with small adjustments, that works pretty good. By default it's excluding the kube-system namespace, but you can adjust this if you need. Also you can add or remove the resources you want to copy.</p> <pre><code>for ns in $(kubectl get ns --no-headers | cut -d " " -f1); do ...
<p>When trying to run <code>build/run.sh</code> on ubuntu 16.04 it fails with the below error message, any ideas?</p> <pre><code>~/dev/kubernetes$ build/run.sh +++ [0117 15:45:56] Verifying Prerequisites.... +++ [0117 15:45:56] Building Docker image kube-build:build-226b89c8c0-4-v1.7.4-1 +++ [0117 15:46:57] Keeping c...
<p>The error is triggered within the script when checking the available arguments. As the error <code>Invalid input - please specify a command to run.</code> states you should use a subcommand / argument for the script as described in the <a href="https://github.com/kubernetes/kubernetes/tree/master/build" rel="nofollo...
<p>I have a strange behaviour from kubelet where soon after cluster is bootsrapped kubelet does not register to the API server.</p> <p>Funny thing is if I restart the kubelet daemon it registers correctly and everything works as expected which let me believe this is a synchronization issue?.(I am using coreos, cloud ...
<p>Sounds like there's a delay in waiting for docker to start or the interfaces to initialize correctly. I found the following issue which sounds exactly like your problem: <a href="https://github.com/kubernetes/kubernetes/issues/33789#issuecomment-251251196" rel="nofollow noreferrer">https://github.com/kubernetes/kube...
<p>I am having a bit of a problem. I deleted a pod of a replication controller and now I want to recreate it. I tried:</p> <pre><code>kubectl create -f kube-controller-manager.yaml Error from server: error when creating "kube-controller-manager.yaml": deployments.extensions "kube-controller-manager" already exists </c...
<p>A replication controller defines what a pod looks like and how many replicas should exist in your cluster. The controller-manager's job is to make sure enough replicas are healthy and running, if not then it will ask the scheduler to place the pods onto hosts. </p> <p>If you delete a pod, then a new one should get ...
<p>This is what I keep getting:</p> <pre><code>[root@centos-master ~]# kubectl get pods NAME READY STATUS RESTARTS AGE nfs-server-h6nw8 1/1 Running 0 1h nfs-web-07rxz 0/1 CrashLoopBackOff 8 16m nfs-web-fdr9h 0/1 CrashLoopBackOf...
<p>As @Sukumar commented, you need to have your Dockerfile have a <a href="https://docs.docker.com/engine/reference/builder/#/cmd" rel="noreferrer">Command</a> to run or have your ReplicationController specify a command. </p> <p>The pod is crashing because it starts up then immediately exits, thus Kubernetes restarts ...
<p><strong>Cannot pull image from local docker insecured registry repository inside Minikube.</strong><br><br> I'm running Docker-toolbox v1.12.2 using Linux VM (Upstart) installed on Oracle VirtualBox 5.1.6 under Windows 7.<br></p> <p>I've created a docker image and push (tag and then push) it into a local insecured ...
<p>Seems like minikube cannot see the same network that your registry is running. Can you try running <code>minikube ssh</code> then run your curl for the catalog? </p> <p>Also, as an alternative, you could run <code>eval(minikube docker-env)</code> which then will set your local docker client to use the docker server...
<p>I'm new to k8s, and recently, I read the cinder volume plugin source code: <a href="https://github.com/kubernetes/kubernetes/tree/master/pkg/volume/cinder" rel="nofollow noreferrer">cinder volume plugin</a>.</p> <p>I don't know how the plugin works, and how it communicates with cinder? And I don't find the request ...
<p>cinder volume is a <a href="https://kubernetes.io/docs/user-guide/persistent-volumes/" rel="nofollow noreferrer">persistent volume</a>, more precisely one of the persistent volume <a href="https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses" rel="nofollow noreferrer">storage classes</a>.</p> <b...
<p>Is there anyway to propagate all kubernetes events to google cloud log?<br><br> For instance, a pod creation/deletion or liveness probing failed, I knew I can use kubectl get events in a console.<br>However, I would like to preserve those events in a log file in the cloud log with other pod level logs.<br> It is qui...
<p>It seems that OP found the logs, but I wasn't able to on GKE (1.4.7) with Stackdriver. It was a little tricky to figure out, so I thought I'd share for others. I was able to get them by creating an eventer deployment with the gcl sink.</p> <p>For example:</p> <p><strong>deployment.yaml</strong></p> <pre><code>k...
<p>I'm very new to Kubernetes and using k8s v1.4, Minikube v0.15.0 and Spotify maven Docker plugin. <br>The build process of my project creates a Docker image and push it directly into the Docker engine of Minikube.</p> <p>The pods are created by the Deployment I've created (using replica set), and the strategy was se...
<p>when not changing the container image name or tag you would just scale your application to 0 and back to the original size with sth like:</p> <pre><code>kubectl scale --replicas=0 deployment application kubectl scale --replicas=1 deployment application </code></pre> <p>As mentioned in the comments already <code>Im...
<p>I am trying to scrape pod level info using prometheus kubernetes. Here is the config i am using:</p> <pre><code> - job_name: 'kubernetes-pods' kubernetes_sd_configs: - api_servers: - 'https://kubernetes.default' role: pod relabel_configs: - source_labels: [__meta_kubernetes_pod_annotation_prometheu...
<p>With that configuration the first action asks that the pod be annotated with <code>prometheus.io/scrape=true</code>. Have you set that annotation on the pods in question?</p>
<p>I am trying to understand <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="noreferrer">Stateful Sets</a>. How does their use differ from the use of "stateless" Pods with Persistent Volumes? That is, assuming that a "normal" Pod may lay claim to persistent storage, what obvious ...
<p>Yes, a regular pod can use a persistent volume. However, sometimes you have multiple pods that logically form a "group". Examples of this would be database replicas, ZooKeeper hosts, Kafka nodes, etc. In all of these cases there's a bunch of servers and they work together and talk to each other. What's special about...
<p>I am no kind of networking genius, and I am a Kubernetes rookie. (What could possibly go wrong?)</p> <p>At work, I am often behind a VPN. I have found that <code>minikube</code> operations hang attempting to connect to my <code>minikube</code>-installed Kubernetes cluster (I'm using VirtualBox on a Mac). When I ...
<p>It is the docker daemon inside minikube that can't connect to the internet. </p> <p>If your VPN enforces a proxy then you need to start it with some docker environment variables. This is how I do it. It is dependent on the environment in my shell but you'll get the idea.</p> <pre><code>minikube start --docker-env ...
<p>I have a simple MYSQL pod sitting behind a MYSQL service. </p> <p>Additionally I have another pod that is running a python process that is trying to connect to the MYSQL pod. </p> <p>If I try connecting to the IP address of the MYSQL pod manually from the python pod, everything is A-OK. However if I try connecting...
<p>So this was the <em>exact correct</em> behavior but I just misconfigured my pods.</p> <p>For future people who are stuck:</p> <p>The selector defined in a kubernetes service must match the label of the pod(s) you wish to serve. IE) In my MySqlService.yaml file I have the name selector for "mysqlpod":</p> <pre><co...
<p>I'm setting up a Flask/uswgi web server. I'm still wondering about the micro-service architecture:</p> <p>Should I put both nginx and Flask with uwsgi in one container or shall I put them in two different containers and link them?</p> <p>I intend to run these services in a Kubernetes cluster.</p> <p>Thanks</p>
<p><strong>Short answer:</strong></p> <p>I would deploy the nginx and uwsgi/flask application as separate containers. This gives you a more flexible architecture that allows you to link more microservices containers to the nginx instance, as your requirements for more services grow.</p> <p><strong>Explanation:</stron...
<p>I have configured kubernetes cluster where it has 2 masters, 3 etcds and 20 nodes. Masters fronted by a load balancer. I followed up <a href="https://coreos.com/kubernetes/docs/latest/getting-started.html" rel="noreferrer">https://coreos.com/kubernetes/docs/latest/getting-started.html</a> when creating the cluster. ...
<p>AWS ELB has a default "IdleTimeout" of 60 seconds, that can be increased up to 3600 seconds. I can confirm that increasing this value solve this issue.</p> <p>Here you can find more information about it: <a href="http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html" rel="nofollow ...
<p>I have setup one persistence volume with 100Gi capacity and setup two different persistence volume claims with 10Gi capacity each in Kubernetes. The first PVC in bond to the PV but the second one is in Pending state. And the "kubectl get pvc" shows the Capacity of the first PVC is 100Gi. </p> <p>Is it possible to...
<p>No thats not possible - one claim will bind the available volume and the other will be pending until another volume is available. Cheers </p>
<p>I've been doing a lot of digging on Kubernetes, and I'm liking what I see a lot! One thing I've been unable to get a clear idea about is what the exact distinctions are between the Deployment and StatefulSet resources and in which scenarios would you use each (or is one generally preferred over the other).</p>
<p>Deployments and ReplicationControllers are meant for stateless usage and are rather lightweight. <a href="https://kubernetes.io/blog/2016/12/statefulset-run-scale-stateful-applications-in-kubernetes/" rel="noreferrer">StatefulSets</a> are used when state has to be persisted. Therefore the latter use <code>volumeClai...
<p>I want to change the number of replications (pods) for a <strong>Deployment</strong> using the Kubernetes API (v1beta1).</p> <p>For now I'm able to increase the replicas from CLI using the command: </p> <pre><code>kubectl scale --replicas=3 deployment my-deployment </code></pre> <p>In the <a href="https://kuberne...
<p>the easiest way is to retrieve the actual data first with:</p> <pre><code>GET /apis/extensions/v1beta1/namespaces/{namespace}/deployments/{name}/scale </code></pre> <p>This will give you an yaml or json object which you can modify and send back with the <code>PUT</code> request.</p> <hr> <p>With curl the roundtr...
<p>Is there a way to configure Portainer's dashboard to show Minikube's docker?</p> <p><strong>Portainer</strong></p> <p>Installed in the local docker (toolbox), on VM under windows 7; the dashboard connection to the local (inside) docker is working fine.</p> <p><code>docker run -d -p 9000:9000 -v /var/run/docker.so...
<p>Are you sure that the Docker API is exposed in the Minikube configuration?</p> <blockquote> <p>Failed to load resource: the server responded with a status of 502 (Bad Gateway)</p> </blockquote> <p>This error is generally raised when Portainer cannot proxy requests to the Docker API.</p> <p>A simple way to verif...
<p>I have deployed Gitlab to my azure kubernetes cluster with a persistant storage defined the following way:</p> <pre><code>kind: PersistentVolume apiVersion: v1 metadata: name: gitlab-data namespace: gitlab spec: capacity: storage: 8Gi accessModes: - ReadWriteMany hostPath: path: "/tmp/gitlab-d...
<p><code>hostPath</code> doesn't share or replicate data between nodes and once your pod starts on another node, the data will be lost. You should consider to use some external shared storage. </p> <p>Here's the related quote from the official docs:</p> <blockquote> <p>HostPath (single node testing only – local sto...
<p><strong>Scenario:</strong></p> <p>I'm trying to run a basic <code>ls</code> command using <code>kubernetes</code> package via <code>cli.connect_post_namespaced_pod_exec()</code> however I get a stacktrace that I do not know how to debug. Yes I have tried searching around but I'm not really sure what the problem is ...
<p>To answer my own question here, this is a bug in actual python binding referenced here: <a href="https://github.com/kubernetes-incubator/client-python/issues/58" rel="nofollow noreferrer">https://github.com/kubernetes-incubator/client-python/issues/58</a></p>
<p>I want to enable Stackdriver logging with my Kubernetes cluster on GKE.</p> <p>It's stated here: <a href="https://kubernetes.io/docs/user-guide/logging/stackdriver/" rel="nofollow noreferrer">https://kubernetes.io/docs/user-guide/logging/stackdriver/</a></p> <blockquote> <p>This article assumes that you have cre...
<p>Unfortunately, logging isn't a setting that can be enabled/disabled on a cluster once it is running. This is something that we hope to change in the near future, but in the mean time your best bet is to delete and recreate your cluster (sorry!). </p>
<p>I am trying to get the output of my pod logs into Stackdriver, but I am running into an issue where they are not being sent to Stackdriver. </p> <p>If I look at the GKE cluster details, it is showing this:</p> <pre><code>Stackdriver Logging - Disabled Stackdriver Monitoring - Enabled </code></pre> <p>I cannot fi...
<p>Currently there is no support for enabling logging in GKE cluster after it's been created. We are aware of the problem and we're going to introduce such possibility.</p> <p>In the meantime you can try the following workarounds:</p> <ul> <li>Create fluentd DaemonSet on your own using <a href="https://github.com/kub...
<p>To preface this I’m working on the GCE, and Kuberenetes. My goal is simply to expose all microservices on my cluster over SSL. Ideally it would work the same as when you expose a deployment via type=‘LoadBalancer’ and get a single external IP. That is my goal but SSL is not available with those basic load balancer...
<p>So, for #2, you've probably ended up provisioning a Google HTTP(S) LoadBalancer, probably because you're missing the <code>kubernetes.io/ingress.class: "nginx"</code> annotation as described here: <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx#running-multiple-ingress-controller...
<p>I am trying to run a Postgresql database using minikube with a persistent volume claim. These are the yaml specifications:</p> <p><strong>minikube-persistent-volume.yaml:</strong></p> <pre><code>kind: PersistentVolume apiVersion: v1 metadata: name: pv0001 labels: type: hostpath spec: capacity: storag...
<p>Maybe you're having a write permission issue with Virtualbox mounting those host folders. Instead, use <code>/data/postgres</code> as a path and things will work.</p> <p>Minikube automatically persists the following directories so they will be preserved even if your VM is rebooted/recreated:</p> <ul> <li><code>/da...
<p>I have installed Docker v1.13 and Kubernetes with Kubeadm v1.6. Then I installed Web UI (Dashboard). I can access it but its missing CPU/Memory usage graphs... Why could this happen? </p>
<p>For me the usage graphs worked once I installed <a href="https://github.com/kubernetes/heapster" rel="nofollow noreferrer">heapster</a> as an addon. Heapster requires an influxdb as data sink for the metric storage. Luckily you can deploy all those easily in k8s with the following definitions in the <code>kube-syste...
<p><strong>2 VPC's:</strong></p> <p><strong>Primary VPC:</strong> 10.111.0.0/22</p> <p>Primary VPC Subnet contains 4 subnets:</p> <pre><code>10.111.0.0/25 10.111.0.128/25 10.111.1.0/25 10.111.1.128/25 </code></pre> <p><strong>Secondary VPC:</strong> Kubernetes Minion VPC (172.16.0.0/20)</p> <p>Additional notes: P...
<p>As soon as you define a service endpoint that is reachable from outside your k8s cluster (no matter if you use the <a href="https://kubernetes.io/docs/user-guide/services/#type-nodeport" rel="nofollow noreferrer"><code>NodePort</code></a> or <a href="https://kubernetes.io/docs/user-guide/services/#type-loadbalancer"...
<p>I stored a RSA key as a secret for my pod, which is used as an environment variable, but my pod keep reporting error because format of my RSA key is incorrect.</p> <p>However; the RSA key work just fine when used locally, so I believe that the RSA key is correct.</p> <p>How can I set an RSA key as an environment v...
<p>Look like the issue is <strong>\n</strong>. Just removing them from my RSA is enough to solve my issue.</p>
<p>What's the easiest way to run a configurable number of identical jobs on Kubernetes but give each of them different parameters (like job number)?</p>
<ol> <li>You could either just have a template job and use bash expansions to have multiple job specifications based of that initial template.</li> </ol> <p>As shown in the official <a href="https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/" rel="nofollow noreferrer">Parallel Processing using Expansio...
<p>I have installed a Kubernetes with Kubeadm tool, and then followed the <a href="https://kubernetes.io/docs/user-guide/ui/" rel="nofollow noreferrer">documentation</a> to install the Web UI (Dashboard). Kubernetes is installed and running in one node instance which is a taint master node. </p> <p>However, I'm not ab...
<p>The URL you are using to access the dashboard is an endpoint on the API Server. By default, <code>kubeadm</code> deploys the API server on port <code>6443</code>, and not on <code>443</code>, which is what you would need to access the dashboard through <code>https</code> without specifying a port in the URL (i.e. <c...
<p>I'm trying to set up a dev environment with Kubernetes via Minikube. I successfully mounted the same volume to the same data dir on the same image with Docker for Mac, but I'm having trouble with Minikube.</p> <p>Relevant files and logs: <code>db-pod.yml</code></p> <pre><code>apiVersion: v1 kind: Pod metadata: c...
<p>I was able to resolve this with the following:</p> <pre><code>echo "/Users -network 192.168.99.0 -mask 255.255.255.0 -alldirs -maproot=root:wheel" | sudo tee -a /etc/exports sudo nfsd restart minikube start minikube ssh -- sudo umount /Users minikube ssh -- sudo /usr/local/etc/init.d/nfs-client start minikube ssh -...
<p>We have 254 nodeports currently in use (we have a number of environments sharing a cluster) and are using the default range. Is there a api parameter that I'm not seeing to bump this limit up?</p>
<p>You probably need to change the <code>--service-cluster-ip-range=</code> on the <a href="https://kubernetes.io/docs/admin/kube-apiserver/" rel="nofollow noreferrer">kube-api-server</a>.</p>
<p>Current docker registry looks support one remote url in config.yml only like:</p> <pre><code>proxy: remoteurl: https://registry-1.docker.io </code></pre> <p>So if docker ask some other image like "gcr.io/google_containers/pause-amd64:3.0", it will not go to the mirror registry.</p> <p>Is it possible to conf...
<p>You need to setup a separate pull-through registry cache for each remote registry you want to proxy. If you were to do a pull on <code>gcr.io/google_containers/pause-amd64:3.0</code>, it will go directly to <code>grc.io</code>. To use the pull-through cache, you need to point to your local cache server instead.</p> ...
<p>The example of <a href="https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/" rel="nofollow noreferrer">running ZooKeeper in Kubernetes</a> shows how pods can be rescheduled on different nodes following a node being drained from connections, typically because maintenance has to be performed on it.</p...
<p>If a node is unresponsive, Kubernetes >=1.5 will <strong>not</strong> reschedule a pod with the same identity until it is confirmed that it has been terminated. The behavior with respect to StatefulSet is detailed <a href="https://kubernetes.io/docs/tasks/manage-stateful-set/delete-pods/#statefulset-considerations" ...
<p>I have multiple Kubernetes pods running on a server. One of the pods contains a database application that only accepts connections from a specific subnet (i.e. other Kubernetes pods).</p> <p>I'm trying to connect to the DB application from the server itself, but the connection is refused because the server's IP is...
<p>The easiest solution is probably to add another container to your pod running socat or something similar and make it listen and connect to your local pod's IP (important: connect to the pod ip, not 127.0.0.1 if your database program is configured to only accept connections from the overlay network). Then modify the ...
<p>I have a Kubernetes <code>Service</code> with a static <code>External IP</code> assigned to a <code>Replication Controller</code> managing 1 application distributed to 2 <code>Pods</code>. I can access the application using the external IP, this part works fine.</p> <p>I'd like now to have the application inside th...
<p>according to the <a href="https://kubernetes.io/docs/user-guide/services/#external-ips" rel="nofollow noreferrer">documentation</a> the <code>externalIP</code> assignment for a <code>Service</code> is just meant for ingress traffic. Along with that the somewhat related <a href="https://docs.openshift.org/latest/dev_...
<p>I have a k8 cluster deployed in AWS using kube-aws. When I deploy a service, a new ELB is added for exposing the service to internet. Can I use ingress-controller to replace ELB or is there any other way to expose services other than ELB?</p>
<p>First, replace <code>type: LoadBalancer</code> with <code>type: ClusterIP</code> in your service definition. Then you have to configure the <a href="https://kubernetes.io/docs/user-guide/ingress/" rel="nofollow noreferrer">ingress</a> and deploy a controller, like <a href="https://github.com/kubernetes/contrib/tree...
<p>I was playing around with Kubernetes on AWS with t2.medium EC2 instances having 20GB of disk space and one of the nodes ran out of disk space after a few days. It seems to be caused by a combination of Docker images and logs. </p> <p>From what I've read, Kubernetes has its own Docker GC to manage Docker's disk usag...
<p>When following the standard installation with the GKE as described in the <a href="https://cloud.google.com/container-engine/docs/quickstart" rel="noreferrer">quickstart guide</a> you'll end up with 3 x n1-standard-1 nodes (see <a href="https://cloud.google.com/compute/docs/machine-types#standard_machine_types" rel=...
<p><strong>The question:</strong> I have a VOIP application running in a kubernetes pod. I need to set in the code the public IP of the host machine on which the pod is running. How can I get this IP via an API call or an environmental variable in kubernetes? (I'm using Google Container Engine if that's relevant.) Than...
<p>You can query the API server for information about the Node running your pod like it's addresses. Since you are using hostNetwork=true the $HOSTNAME environment variable identifies the node already.</p> <p>There is an example below that was tested on GCE.</p> <p>The code needs to be run in a pod. You need to insta...
<p>I am becoming more familiar with Kubernetes by the day, but am still at a basic level. I am also not a networking guy.</p> <p>I am staring at the following snippet of a Service definition, and I can't form the right picture in my mind of what is being declared:</p> <pre><code>spec: type: NodePort ports: - p...
<p><code>nodePort</code> is the port that a client outside of the cluster will "see". <code>nodePort</code> is opened on every node in your cluster via <a href="https://kubernetes.io/docs/user-guide/services/#type-nodeport" rel="noreferrer">kube-proxy</a>. With iptables magic Kubernetes (k8s) then routes traffic from t...
<p>I am creating a MongoDB cluster on Kubernetes using Stateful sets. I have 3 mongo replicas configured in my Stateful set. </p> <p>Now I create Stateful set and service using just one command</p> <blockquote> <p>kubectl create -f mongo-stateful.yaml</p> </blockquote> <p>Then I use the mongo client to initiate mo...
<p>This might be what you're looking for: </p> <p><a href="http://blog.kubernetes.io/2017/01/running-mongodb-on-kubernetes-with-statefulsets.html" rel="nofollow noreferrer">http://blog.kubernetes.io/2017/01/running-mongodb-on-kubernetes-with-statefulsets.html</a></p>
<p>I have a dockerfile of a ruby app that runs a puma server on port 5000. (It EXPOSE the port and also uses the RUN command to run puma -p 5000.</p> <p>In my deployment.yaml I have to set <code>containerPort</code> to be 5000 to match this port.</p> <p>This seems odd to me that my configuration lists the port in 2 d...
<p>In your deployment.yaml you actually don't have to specify the <code>containerPort</code>; all ports are exposed. From the <a href="https://kubernetes.io/docs/api-reference/v1.5/#container-v1" rel="nofollow noreferrer">docs</a>:</p> <blockquote> <p>ports <em>ContainerPort array</em></p> <p>List of ports to expose fr...
<p>We have a case where we need to make sure that pods in k8s have the latest version possible. <em>What is the best way to accomplish this</em>?</p> <p>First idea was to kill the pod after some point, knowing that the new ones will come up pulling the latest image. Here is <a href="https://github.com/kubernetes/kuber...
<p>As mentioned by @svenwltr using <code>activeDeadlineSeconds</code> is an easy option but comes with the risk of loosing all pods at once. To mitigate that risk I'd use a <code>deployment</code> to manage the pods and their rollout, and configure a small second container along with the actual application. The small h...
<p>In kubernetes pod yaml specification file, you can set a pod to use the host machine's network using <code>hostNetwork:true</code>.</p> <p>I can't find anywhere a good (suitable for a beginner) explanation of what the <code>hostPID:true</code> and <code>hostIPC:true</code> options mean. Please could someone explain ...
<p>they're roughly described within the <a href="https://kubernetes.io/docs/concepts/policy/pod-security-policy/#host-namespaces" rel="noreferrer">Pod Security Policies</a></p> <blockquote> <p><code>hostPID</code> - Use the host’s pid namespace. Optional: Default to false.</p> <p><code>hostIPC</code> - Use the host’s i...
<p>I have a Kubernetes <code>Service</code> with a static <code>External IP</code> assigned to a <code>Replication Controller</code> managing 1 application distributed to 2 <code>Pods</code>. I can access the application using the external IP, this part works fine.</p> <p>I'd like now to have the application inside th...
<p>Theshort and simple answer is - you can't. Your pods are assigned IPs that are internal to your cluster, most likely from a per node range of particular cluster wide network address space. When talking to external world, pods traffic originates on an internally bridged interface/IP and if the destination is not part...
<p>I have a 5-nodes Kubernetes cluster of which 1 is the master (set up with kubeadm). When I first deployed the master node I deployed also the kubernetes dashboard so it's running on the same machine. After that I joined the other nodes to the cluster.</p> <p>Now when I deploy a pod using a YAML file it stays in the ...
<p>You need to run kubelet as root (see first line of log). This a a known limitation at the moment:</p> <p><a href="https://github.com/kubernetes/kubernetes/issues/4869" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/4869</a></p>
<p>While running Prometheus in Kubernetes, I'm pushing out new config via a <code>ConfigMap</code>. ConfigMaps are exposed as files in the container.</p> <p>I would love Prometheus to automatically reload its configuration when the file changes.</p> <p>Would something like this work?</p> <pre><code>inotifywait -q -m...
<p>(Edit: I took some time to get this fully to work) this works with a small sidecar container. The configuration could look like this:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: prometheus spec: replicas: 1 template: .... spec: containers: ... (your act...
<p>I have the following questions:</p> <ol> <li><p>I am logged into a Kubernetes pod using the following command:</p> <pre><code> ./cluster/kubectl.sh exec my-nginx-0onux -c my-nginx -it bash </code></pre> <p>The 'ip addr show' command shows its assigned the ip of the pod. Since pod is a logical concept, I am assuming ...
<p>Here is how you get a curl command line within a kubernetes network to test and explore your internal REST endpoints.</p> <p>To get a prompt of a busybox running inside the network, execute the following command. (A tip is to use one unique container per developer.)</p> <pre class="lang-bash prettyprint-override"><c...
<p>I have a kubernetes cluster with 5 nodes. When I add a simple nginx pod it will be scheduled to one of the nodes but it will not start up. It will not even pull the image.</p> <p>This is the nginx.yaml file:</p> <pre><code>apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - name: nginx im...
<p>You can do</p> <pre><code>kubectl describe pods &lt;pod&gt; </code></pre> <p>to get more info on what's happening.</p>
<p>We are running a Kubernetes Cluster in AWS and we are collecting the metrics in DataDog using the dd-agent DaemonSet.</p> <p>We have a Pod being displayed in our metrics tagged as "no_pod" and it is using a lot of resources, Memory/CPU/NetworkTx/NetworkRX.</p> <p>Is there any explanation to what this pod is, how I...
<p>After speaking to the support team at DataDog, I managed to find out the following information relating to what the no_pod pods were.</p> <blockquote> <p>Our Kubernetes check is getting the list of containers from the Kubernetes API, which exposes aggregated data. In the metric explorer configuration here, you ca...
<p>I looked into the service account ca.crt files that get deployed into the container and they don't contain any SAN with the IP or dns name of the master nodes. This results in SSL errors like: <a href="https://0.0.0.0:10250/metrics" rel="nofollow noreferrer">https://0.0.0.0:10250/metrics</a>: x509: cannot validate c...
<p>The ca cert provided by a service account (<code>/run/secrets/kubernetes.io/serviceaccount/ca.crt</code>) is for communicating with the apiserver (served by the master on GKE).</p> <pre><code># curl --cacert /run/secrets/kubernetes.io/serviceaccount/ca.crt https://kubernetes -H "Authorization: Bearer $(cat /run/sec...