Question
stringlengths
65
39.6k
QuestionAuthor
stringlengths
3
30
Answer
stringlengths
38
29.1k
AnswerAuthor
stringlengths
3
30
<p>For one POD, three images has been created. The problem here is that there is no communication between containers within same pod. How should my application connected with these three containers?</p> <p>My pod have below containers.</p> <pre><code>[dev-application dev-app-nginx dev-app-redis] </code></pre> <p>Here I...
User1984
<p>Use <strong>localhost</strong> to communicate with other containers within the same pod.</p> <p>E.g. the addresses to the containers are</p> <ul> <li>127.0.0.1:3000</li> <li>127.0.0.1:80</li> <li>127.0.0.1:6379</li> </ul>
Jonas
<p>How can I delete more than couple of pods at a time?</p> <p>The commands I run:</p> <pre><code>kubectl delete pod pod1 kubectl delete pod pod2 kubectl delete pod pod3 </code></pre> <p>The approach I want to use:</p> <pre><code>kubectl delete pod pod1 pod2 pod3 </code></pre> <p>Any commands or style that can help me ...
cosmos-1905-14
<p>The approach that you say that you want:</p> <pre><code>kubectl delete pod pod1 pod2 pod3 </code></pre> <p><strong>actually works</strong>. Go ahead and use it if you want.</p> <p>In Kubernetes it is more common to operate on subsets that share common labels, e.g:</p> <pre><code>kubectl delete pod -l app=myapp </cod...
Jonas
<p>I'm in the process of moving web services from one Kubernetes cluster to another. The goal is to do that without service interruption.</p> <p>This is difficult with cert-manager and HTTP challenges, because cert-manager on the new cluster can only retrieve a certificate once the DNS entry points to that cluster. How...
theDmi
<p>Certificates are stored in Kubernetes secrets. Cert-manager will pick up existing secrets instead of creating new ones, if the secret matches the ingress object.</p> <p>So assuming that the ingress object looks the same on both clusters, and that the same namespace is used, copying the secret is as simple as this:</...
theDmi
<p>Very new to Kubernetes. In the past I've used <code>kubectl</code>/Kustomize to deploy pods/services using the same repetitive pattern:</p> <ol> <li>On the file system, in my project, I'll have two YAML files such as <code>kustomization.yml</code> and <code>my-app-service.yml</code> that look something like:</li> </...
hotmeatballsoup
<p>You can create a pod running a container with the given image with this command:</p> <pre><code>kubectl run my-debug-pod --image=google/cloud-sdk </code></pre> <hr /> <p>And if you want to create a Deployment without writing the Yaml, you can do:</p> <pre><code>kubectl create deployment my-app --image=my-container-i...
Jonas
<p>I am trying to update my deployment with latest image content on Azure Kubernetes Service every time some code is committed to github . I have made a stage in my build pipeline to build and push the image on docker hub which is working perfectly fine. however in my release pipeline the image is being used as an arti...
Shubham Tiwari
<p>When you relese a new image to the container registry under the same tag it does not mean anything to Kubernetes. If you run <code>kubectl apply -f ...</code> and the image name and tag remains the same, it still won't do anything as there is no configuration change. There are two options:</p> <ol> <li><p>Give a ne...
Piotr Gwiazda
<p>I am trying to setup Kuberentes for my company. In that process I am trying to learn Helm.</p> <p>One of the tasks I have is to setup automation to take a supplied namespace <em>name</em> parameter, and create a namespace and setup the correct permissions in that namespace for the deployment user account.</p> <p>I ...
Vaccano
<p>Almost <a href="https://github.com/nginxinc/kubernetes-ingress/blob/v1.10.0/deployments/helm-chart/templates/rbac.yaml#L2" rel="nofollow noreferrer">any chart</a> for an install that needs to interact with kubernetes itself will include RBAC resources, so it is for sure not just Deployments</p> <pre class="lang-yaml...
mdaniel
<p>Imagine the following deployment definition in kubernetes:</p> <pre><code>apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: env: staging spec: ... </code></pre> <p>I have two questions in particular:</p> <p>1). The label <code>env: staging</code> won't be available in created pods. ho...
Elaheh
<blockquote> <p>1). the label env: staging won't be available in created pods. how can I access this data programmatically in client-go?</p> </blockquote> <p>You can get the <code>Deployment</code> using client-go. See the example <a href="https://github.com/kubernetes/client-go/tree/master/examples/create-update-delet...
Jonas
<p>From the time I have upgraded the versions of my eks terraform script. I keep getting error after error.</p> <p>currently I am stuck on this error:</p> <blockquote> <p>Error: Get <a href="http://localhost/api/v1/namespaces/kube-system/serviceaccounts/tiller" rel="nofollow noreferrer">http://localhost/api/v1/name...
gamechanger17
<p>It means your <code>server:</code> entry in your <code>.kube_config.yml</code> is pointing to the wrong port (and perhaps even the wrong protocol, as normal kubernetes communication travels over <code>https</code> and is secured via mutual TLS authentication), or there is no longer a proxy that <em>was</em> listenin...
mdaniel
<p>I'm using the <a href="https://github.com/kubernetes-client/csharp" rel="nofollow noreferrer">C# client API</a> and I'm trying to:</p> <ol> <li>Get all pods associated with a given StatefulSet</li> <li>Get the cluster IP address of each pod</li> </ol> <p>I am aware of <code>Kubernetes.CoreV1.ListNamespacedPodAsync</...
fr0
<p>A feature of Kubernetes StatefulSet is <em>Stable Network Identity</em>. This requires that additional <em>headless Services</em> are created, in addition to the <code>StatefulSet</code> resource.</p> <p>When this is done, you would typically access these instances by their <strong>hostname</strong> instead of using...
Jonas
<p>When i am trying to mount application log volume from containers to host getting error: Operation not permitted</p> <pre><code>spec: securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000 initContainers: - name: volume-mount-permission image: xx.xx.xx.xx/orchestration/credit-card ...
Ravikant Kumar
<pre><code> securityContext: runAsUser: 1000 runAsGroup: 3000 </code></pre> <p>means you cannot <code>chown 1000:1000</code> because that user is not a member of <strong>group</strong> <code>1000</code></p> <p>Likely you will want to run that <code>initContainer:</code> as <code>runAsUser: 0</code> in order ...
mdaniel
<p>I built an application using Docker Compose which included an Nginx instance accepting connections on port 80:</p> <pre><code> nginx: image: nginx:1.15.12-alpine container_name: nginx volumes: - etc. ports: - 80:80 </code></pre> <p>I'd like to spin up this application on Kubernetes run...
rgov
<p>See:</p> <p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport</a></p> <p>Your "connect to" URL from your local machine to a K8 world will not be "172.x.x.x". It will prob...
granadaCoder
<p>Helllo does any one have an idea and can help here ? - I can not run a for me very complicated curl command i have some troubles to understand why its not working</p> <p>I try to copy data via curl into a Wordpress Directory - at a POD from Kubernetes</p> <pre><code>kubectl exec $WPPOD -- curl --request GET --head...
Bliv_Dev
<p>You have two pieces of bad shell going on here:</p> <p>The first one is because the redirection is happening <strong>on your machine</strong>. The second is because everything after the <code>&gt;</code> is a filename, but you have included random arguments to <code>curl</code> in them.</p> <p>To solve the first o...
mdaniel
<p>I need to know how to connect my Kubernetes cluster to an external SQL Server database running in a docker image outside of the Kubernetes cluster. </p> <p>I currently have two pods in my cluster that are running, each has a different image in it created from asp.net core applications. There is a completely separa...
C1pher6710
<p>When running from local docker, you connection string is NOT your local machine. It is the local docker "world", that happens to be running on your machine.</p> <p>host.docker.internal:1433</p> <p>The above is docker container talking to your local machine. Obviously, the port could be different based on how you ...
granadaCoder
<p>I'm trying to automate the process of horizontal scale up and scale down of elasticsearch nodes in kubernetes cluster.</p> <p>Initially, I deployed an elasticsearch cluster (3 master, 3 data &amp; 3 ingest nodes) on a Kubernetes cluster. Where, <code>cluster.initial_master_nodes</code> was:</p> <pre class="lang-ya...
Kamol Hasan
<p>The <code>cluster.initial_master_nodes</code> setting only has an effect the first time the cluster starts up, but to avoid some very rare corner cases you should never change its value once you've set it and generally you should remove it from the config file as soon as possible. From <a href="https://www.elastic.c...
Dave Turner
<p>I try to run some ansible tasks with the k8s module. Locally this works perfect, but on my Jenkins instance, it fails with the following error message:</p> <blockquote> <p>...</p> <p>MaxRetryError(_pool, url, error or ResponseError(cause))\nurllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xxxx...
EllisTheEllice
<p>I agree with @ilias-sp but it also appears that <a href="https://github.com/ansible/ansible/blob/v2.8.5/lib/ansible/module_utils/k8s/common.py" rel="nofollow noreferrer"><code>k8s/common.py</code></a> does not support the <a href="https://github.com/kubernetes-client/python/blob/v10.0.1/kubernetes/client/configurati...
mdaniel
<p>Is possible to gain k8s cluster access with serviceaccount token?</p> <p>My script does not have access to a kubeconfig file, however, it does have access to the service account token at /var/run/secrets/kubernetes.io/serviceaccount/token.</p> <p>Here are the steps I tried but it is not working.</p> <ol> <li>kubectl...
Chris Jones
<blockquote> <p>Is possible to gain k8s cluster access with serviceaccount token?</p> </blockquote> <p>Certainly, that's the point of a ServiceAccount token. The question you appear to be asking is &quot;why does my <code>default</code> ServiceAccount not have all the privileges I want&quot;, which is a different probl...
mdaniel
<p>In the <code>create_namespaced_job</code> method there is no parameter that exists to define <code>preStop</code> and <code>postStart</code> handlers.</p> <pre><code>V1Job create_namespaced_job(namespace, body, pretty=pretty, dry_run=dry_run, field_manager=field_manager) </code></pre> <p><a href="https://github.com/...
shiva
<blockquote> <p>In the create_namespaced_job method there is no parameter that exists to define preStop and postStart handlers.</p> </blockquote> <p>The <code>preStop</code> and <code>postStart</code> handlers exists on the containers. You linked to the documentation for <a href="https://github.com/kubernetes-client/py...
Jonas
<p>I am new to gitlab CI. So I am trying to use <a href="https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml" rel="noreferrer">https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml</a>, to deploy simple test django app to ...
Testobile Testossimo
<blockquote> <p>error: arguments in resource/name form must have a single resource and name</p> </blockquote> <p>That issue you linked to has <code>Closed (moved)</code> in its status because it was moved from <a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/66016#note_203406467" rel="noreferrer">issue 66016<...
mdaniel
<p>Given this <code>deployment.yaml</code></p> <pre><code>apiVersion: apps/v1 kind: Deployment metadata: name: deployment spec: revisionHistoryLimit: 5 template: spec: containers: {{- include &quot;app.container&quot; (merge .Values.app $) | nindent 8 }} {{- include &quot;ports&quot; (merge ...
gurpsone
<p>So there are a couple of things going on here, but mostly the answer is that <code>(mergeMustOverwrite)</code> <strong>mutates</strong> the <code>$dest</code> map, which causes your range to &quot;remember&quot; the last value it saw, which according to your question isn't the behavior you want. The simplest answer ...
mdaniel
<p>I am trying to find the simpliest method to use kubernetes in production. YAML templates look like an overhead to me. E.g. all I want is expose simple backend service. I can do it with kubectl with 2 lean commands:</p> <pre><code>kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0 kube...
Anatolii Stepaniuk
<p>I am quoting the original question here:</p> <blockquote> <p>kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0 kubectl expose deployment hello-server --type LoadBalancer --port 80 --target-port 8080</p> </blockquote> <blockquote> <p>But is it fine to use this in production? I would l...
Jonas
<p>Imagine in a Master-Node-Node setup where you deploy a service with pod anti-affinity on the Nodes: An update of the Deployment will cause another pod being created but the scheduler not being able to schedule, because both Nodes have the anti-affinity.</p> <p><strong>Q:</strong> How could one more flexibly set the...
eljefedelrodeodeljefe
<p>Look at <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#max-surge" rel="noreferrer">Max Surge</a></p> <p>If you set Max Surge = 0, you are telling Kubernetes that you won't allow it to create more pods than the number of replicas you have setup for the deployment. This basically forc...
Silas Hansen
<p>I am running single node K8s cluster and my machine has 250GB memory. I am trying to launch multiple pods each needing atleast 50GB memory. I am setting my pod specifications as following.</p> <p><a href="https://i.stack.imgur.com/xS1Em.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xS1Em.png" al...
ankit patel
<blockquote> <p>now at first this does not make sense - i have 250GB memory so i should be able to launch five pods each requesting 50GB memory. shouldn't i?</p> </blockquote> <p>This depends on how much memory that is &quot;allocatable&quot; on your node. Some memory may be reserved for e.g. OS or other system tasks.<...
Jonas
<p>Currently practicing with Kubernetes (managed, on DO), I ran into a issue I couldn't resolve for two days. I have nginx-ingress setup along with cert-manager, and a domain where git.domain.com points to the IP of the load balancer. I can reach my Gitea deployment via the web, everything seems to work.</p> <p>What I...
Teecup
<blockquote> <p>So I somehow need to expose the container port 22 via the service, then via the ingress</p> </blockquote> <p>So yes and no: an Ingress is specifically for virtual-hosting using the <code>host:</code> header (or SNI) of the incoming request to know which backend to use. There is no such mechanism in S...
mdaniel
<p>While running kubernetes clusters, I've noticed that when a secret's value is changed <a href="https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables" rel="nofollow noreferrer">pods that use it as an environment variable</a> are <em>not</em> rebuilt and my applications <em>d...
Mike Marcacci
<p>No, nor does any such thing happen on <code>ConfigMap</code> mounts, env-var injection, or any other situation; signals are sent to your process only as a side-effect of Pod termination</p> <p>There are <a href="https://duckduckgo.com/?q=kubernetes+reload+configmap+secret&amp;atb=v73-4_q&amp;ia=web" rel="nofollow n...
mdaniel
<p>I have a Tekton <code>Pipeline</code> and <code>PipelineRun</code> definitions. But, I couldn't achieve to run <code>Pipeline</code> via passing parameter.</p> <pre><code>apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: generateName: build-deploy- labels: tekton.dev/pipeline: build-deploy spec: s...
jdev
<p>You cannot pass those parameters when using <code>kubectl create</code>.</p> <p>There are two alternatives:</p> <h2>Use tkn cli</h2> <p>You can use <a href="https://github.com/tektoncd/cli" rel="nofollow noreferrer">tkn</a>, a purpose made CLI for Tekton. Then you can start a run of a Pipeline with, e.g.:</p> <pre><...
Jonas
<p>I am check etcd(3.3.13) cluster status using this command:</p> <pre><code>[root@iZuf63refzweg1d9dh94t8Z work]# /opt/k8s/bin/etcdctl endpoint health --cluster https://172.19.150.82:2379 is unhealthy: failed to connect: context deadline exceeded https://172.19.104.231:2379 is unhealthy: failed to connect: context dea...
Dolphin
<blockquote> <p>how to solve the context deadline exceeded error?</p> </blockquote> <p>That error is misleading; it is <em>usually</em> caused by <code>etcdctl</code> not providing credentials and/or not using the same <code>ETCDCTL_API=</code> value as the cluster. If it's a modern <code>etcd</code> version, you'll...
mdaniel
<p>I have seen the one-pod &lt;-&gt; one-container rule, which seems to apply to business logic pods, but has exceptions when it comes to shared network/volume related resources.</p> <p>What are encountered production uses of deploying pods without a deployment configuration?</p>
Olshansky
<p>I use pods directly to start a Centos (or other operating system) container in which to verify connections or test command line options.</p> <p>As a specific example, below is a shell script that starts an <code>ubuntu</code> container. You can easily modify the manifest to test secret access or change the service a...
David Medinets
<p>So, we are thinking about switching our production server to Kubernetes. Right now, it's not really professional as it's only one single nginx instance. 99% of the time our server needs to handle about 30 requests a minute, which it easily manages to do. On <strong>specific times, that we exactly know of in before</...
crimbler2
<p>There are a number of way to autoscale Pods in Kubernetes.</p> <h2>Horizontal Pod Autoscaler</h2> <p>You can use an <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">Horizontal Pod Autoscaler</a> to scale up Pods reactively, based on metrics. You can also ...
Jonas
<p>I have an image which contains data inside /usr/data/webroot. This data should be moved on container init to /var/www/html.</p> <p>Now I stumbeled upon InitContainers. As I understand it, it can be used to execute tasks on container initialization. </p> <p>But I don't know if the task is beeing excuted after the a...
John Jameson
<blockquote> <p>But I don't know if the task is beeing excuted after the amo-magento pods are created, or if the init task runs, and after that the magento pods are created.</p> </blockquote> <p>For sure the latter, that's why you are able to specify an <strong>entirely different</strong> <code>image:</code> for you...
mdaniel
<p>When I run <code>kubectl</code> inside of a pod it defaults to "in-cluster config" (defined by files in <code>/var/run/secrets/kubernetes.io/serviceaccount</code>). If I want to wrap <code>kubectl</code> inside of a call to Python subprocess with <code>shell=False</code>, how do I tell <code>kubectl</code> where to ...
Joe J
<p>You will have to construct a <code>KUBECONFIG</code> by hand, given those values, since that's more-or-less exactly what the <a href="https://github.com/kubernetes-client/python-base/blob/474e9fb32293fa05098e920967bb0e0645182d5b/config/incluster_config.py#L81-L86" rel="nofollow noreferrer">python client does anyway<...
mdaniel
<p>I develop a .NET API and I want to deploy it in a Kubernetes pod. I'm using InClusterConfig():</p> <pre><code>var config = KubernetesClientConfiguration.InClusterConfig(); _client = new Kubernetes(config); </code></pre> <p>I follow this issue (<a href="https://stackoverflow.com/questions/63232463/accessing-kubernete...
glorfindel
<p>The Pod will use the ServiceAccount specified in the Pod-manifest, if not specified the <code>default</code> ServiceAccount in the namespace will be used.</p> <p>You can specify the ServiceAccount for a Pod with the <code>serviceAccountName:</code>-field:</p> <pre><code>apiVersion: v1 kind: Pod metadata: name: my-...
Jonas
<p>Trying to install kubernetes on virtualbox using ansible:</p> <p>in master-playbook.yml</p> <pre><code> - name: Install comodo cert copy: src=BCPSG.pem dest=/etc/ssl/certs/ca-certificates.crt - name: Update cert index shell: /usr/sbin/update-ca-certificates - name: Adding apt repository for Kubernet...
kamal
<p>As is described in <a href="https://kubernetes.io/docs/setup/independent/install-kubeadm/#installing-kubeadm-kubelet-and-kubectl" rel="nofollow noreferrer">the fine manual</a>, you must first add the GPG signing key with <code>apt-key</code> or the ansible module <a href="https://docs.ansible.com/ansible/2.7/modules...
mdaniel
<p>I'm having an extremely hard time setting up EKS on AWS. I've followed this tutorial: <a href="https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-launch-workers" rel="noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-launch-workers</a></p> <p>I got up to th...
Alex Miles
<p>This issue occurs if your <code>user</code> configuration isn't working in your <code>kubeconfig</code>, or if you are on a version of <code>kubectl</code> less than v1.10</p>
monokrome
<p>So, a StatefulSet creates a new volume for each of its pod.</p> <p>How does it maintain consistency of the written data. Because, each pod may serve a different client at a specific moment in time and will be writing different stuff to the volume. But, if this client tries to access the data later, it will have to ...
Aniket
<blockquote> <p>How does it maintain consistency of the written data. Because, each pod may serve a different client at a specific moment in time and will be writing different stuff to the volume. But, if this client tries to access the data later, it will have to connect to the same pod somehow to access its own data....
Jonas
<p>I am playing with Kubernetes on <a href="https://labs.play-with-k8s.com" rel="nofollow noreferrer">https://labs.play-with-k8s.com</a>.<br> I tried to use the <code>kubectl proxy</code> following the instructions in <a href="https://kubernetes.io/docs/tasks/access-kubernetes-api/http-proxy-access-api/#using-kubectl-t...
E235
<blockquote> <p>Starting to serve on 127.0.0.1:8080</p> </blockquote> <p>As shown in the message it emits on startup, that is because <code>kubectl proxy</code> <strong>only</strong> listens on localhost (i.e. <code>127.0.0.1</code>), unless you instruct it otherwise:</p> <pre><code>kubectl proxy --address=0.0.0.0 ...
mdaniel
<p>For any node, we can just do</p> <pre><code>node, err := clientset.corev1().Node(&quot;node_name&quot;).Get(...) </code></pre> <p>I am looking for something similar to view the kubelet agent. <code>clientset.corev1().Pod</code> does not have them since it is not managed by api server.</p> <p>Is there a way to progra...
Fermat's Little Student
<blockquote> <p>Is there a way to programmatically retrieve this information?</p> </blockquote> <p>No. The kubelet is not a <em>resource</em> (e.g. <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#kubernetes-objects" rel="nofollow noreferrer">API resource / object</a>) in K...
Jonas
<p>I want to deploy kafka on kubernetes.</p> <p>Because I will be streaming with high bandwidth from the internet to kafka I want to use the hostport and advertise the hosts "dnsName:hostPort" to zookeeper so that all traffic goes directly to the kafka broker (as opposed to using nodeport and a loadbalancer where traf...
herm
<blockquote> <p>How can I pass that information to the container? Ideally I could do this from the deployment yaml but I'm also open to other solutions.</p> </blockquote> <p>The first thing I would try is <code>envFrom: fieldRef:</code> and see if it will let you reach into the <code>PodSpec</code>'s <code>status:</...
mdaniel
<p>When reading through the kubernetes document I noticed that NodePort type service always automatically creates a ClusterIP and ingress traffic targeting NodePort will be routed to ClusterIP. My question is that why is this necessary? Why can't kubeproxy directly does load balancing for this NodePort through forwardi...
Michael Ma
<p>Even <code>Service</code> of type <code>NodePort</code> does not directly contact Pods, they still go through the Service's cluster IP, and its associated Pod selector rules. With newer kubernetes I think you can also influence whether traffic is round-robin or weighted distributed, which wouldn't work if the NodePo...
mdaniel
<p>I am trying to view portal that build with angular uses netcore backend runs on docker swarm fluently. When I try to deploy angular image on openshift, I get following error;</p> <pre><code>[emerg] 1#1: bind() to 0.0.0.0:80 failed (13: Permission denied) nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission den...
ahmet budak
<p>OpenShift will not run your container as root, so it cannot listen on port 80. Choose a port &gt;1024, e.g. port 8080 instead, and it should work.</p>
Jonas
<p>When run <code>kubectl get cs</code> on centos 7 I got below error message. </p> <pre><code>No resources found. Error from server (Forbidden): componentstatuses is forbidden: User "system:node:&lt;server-name&gt;" cannot list componentstatuses at the cluster scope </code></pre> <p>I can confirm the api server is ...
Antelope
<blockquote> <p><code>export KUBECONFIG=/etc/kubernetes/kubelet.conf</code></p> </blockquote> <p>Is completely incorrect; you are, as the error message is cheerfully trying to inform you, attempting to perform cluster operations as a <code>Node</code>, not as one of the Users or <code>ServiceAccount</code>s. RBAC is...
mdaniel
<p>I've setup a cronjob in Openshift. I can see its logs through the Web Console but I want to receive a mail containing the output of the job whenever it completes. How do I go about implementing this?</p>
vatsal
<p>You can add sth. like "mailx" to your cronjob image and forward the output.</p> <p>In the following example "mailgateway.default.svc" is a service route to a mailgateway outside the cluster:</p> <pre><code>&lt;output_producing_command&gt; | mailx -E -v -s "Subject" -S smtp=smtp://mailgateway.default.svc:25 -S from...
Milde
<p>I'm using Ansible and the <code>k8s</code> module for deploying applications to an OpenShift cluster. In general this is working really well.</p> <p>However, when I try to set the port value, in a deployment config, using a value from a variable, things are not so happy.</p> <p>I have the following ansible task as...
Magick
<p>According to the posted error message, your problem isn't <code>|int</code> or <code>|string</code> -- although I agree the error message is misleading:</p> <blockquote> <p>"message": "Service \"usdt-wallet\" is invalid: spec.ports[0].targetPort: Invalid value: \"70001\": must contain at least one letter or numbe...
mdaniel
<p>Can we use nfs volume plugin to maintain the High Availability and Disaster Recovery among the kubernetes cluster?</p> <p>I am running the pod with MongoDB. Getting the error </p> <blockquote> <p>chown: changing ownership of '/data/db': Operation not permitted .</p> </blockquote> <p>Cloud any body, Please sugg...
BSG
<blockquote> <p>chown: changing ownership of '/data/db': Operation not permitted .</p> </blockquote> <p>You'll want to either launch the mongo container as <code>root</code>, so that you <em>can</em> <code>chown</code> the directory, or if the image prohibits it (as some images already have a <code>USER mongo</code>...
mdaniel
<p>I have successfully deployed a multi master Kubernetes cluster using the repo <a href="https://github.com/kubernetes-sigs/kubespray" rel="nofollow noreferrer">https://github.com/kubernetes-sigs/kubespray</a> and everything works fine. But when I stop/terminate a node in the cluster, new node is not joining to the cl...
manu thankachan
<p>It is expected behavior because kubespray doesn't create any ASGs, which are AWS-specific resources. One will observe that kubespray only deals with <em>existing</em> machines; they do offer some terraform toys in their repo for <em>provisioning</em> machines, but kubespray itself does not get into that business.</p...
mdaniel
<p>To build a highly available <code>k8s</code> cluster, you need to build an <code>etcd</code> cluster, which I see in the official <code>k8s</code> documentation.</p> <p><a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/ha-topology" rel="nofollow noreferrer">Each control plane node create...
山河以无恙
<blockquote> <p>In fact, there is only one Leader in the cluster. Does this read/write separation of etcd clusters apply to Kubernetes?</p> </blockquote> <p>Yes. In an etc cluster, there is only one leader that does the writes. But etcd internally forwards all requests that needs <em>consensus</em> (e.g. writes) to the...
Jonas
<p>I have a repository with a Kubernetes deployment YAML. Pipelines run on each commit that builds and pushes an image into our repository, versioned with the commit (eg. <code>my_project:bm4a83</code>). Then I'm updating the deployment image</p> <p><code>kubectl set image deployment/my_deployment my_deployment=my_pro...
Richard Taylor
<blockquote> <p>What's a sensible workflow for managing this? Am I missing something entirely?</p> </blockquote> <p>Some of the answer depends on the kind of risk you're trying to drive down with any process you have in place. If it's "the cluster was wiped out by a hurricane and I need to recover my descriptors," t...
mdaniel
<p>i am getting </p> <pre><code>0/7 nodes are available: 2 node(s) had taints that the pod didn't tolerate, 5 node(s) had volume node affinity conflict. </code></pre> <p>for my prometheus server pod but if i check each nodes there are no taints. and there is enough cpu and memory to be allocated.. what am i missing ...
markrosario
<blockquote> <p>0/7 nodes are available: 2 node(s) had taints that the pod didn't tolerate, 5 node(s) had volume node affinity conflict. </p> </blockquote> <p>The message is specific: it's not the <em>taints</em> that are keeping your prometheus pods off of your workers, it's the <strong>volume</strong> that is the ...
mdaniel
<p>I know why use StatefulSet for stateful applications. (e.g. DB or something) In most cases, I can see like &quot;You want to deploy stateful app to k8s? Use StatefulSet!&quot; However, I couldn't see like &quot;You want to deploy stateless app to k8s? Then, DO NOT USE StatefulSet&quot; ever.</p> <p>Even nobody says ...
Eddy Kim
<h2>Different Priorities</h2> <p>What happens when a Node becomes unreachable in a cluster?</p> <h2>Deployment - Stateless apps</h2> <p>You want to maximize availability. As soon as Kubernetes detects that there are fewer than the desired number of replicas running in your cluster, the controllers spawn new replicas of...
Jonas
<p>I'm running a Kubernetes cluster in a public cloud (Azure/AWS/Google Cloud), and I have some non-HTTP services I'd like to expose for users.</p> <p>For HTTP services, I'd typically use an Ingress resource to expose that service publicly through an addressable DNS entry.</p> <p>For non-HTTP, TCP-based services (e.g...
cjheppell
<blockquote> <p>For non-HTTP, TCP-based services (e.g, a database such as PostgreSQL) how should I expose these for public consumption?</p> </blockquote> <p>Well, that depends on how you expect the ultimate user to <strong>address</strong> those Services? As you pointed out, with an Ingress, it is possible to use vi...
mdaniel
<p>I've got a single-node Kubernetes "cluster" built with <code>kubeadm</code> in AWS. </p> <p>I have deployed a simple Nginx deployment with this config:</p> <pre><code>kind: Deployment apiVersion: apps/v1 metadata: name: nginx0-deployment labels: app: nginx0-deployment spec: replicas: 1 selector: ma...
KeepLearning
<p>You have the wrong labels; your <strong>Deployment</strong> has <code>app: nginx0-deployment</code> but your <strong>Pods</strong> have <code>app: nginx0</code> and <code>Service</code>s don't target Deployments, they target Pods</p> <p>Update your <code>Service</code> to have:</p> <pre><code>spec: selector: ...
mdaniel
<p>I have a helm repo:</p> <p><code>helm repo list</code></p> <blockquote> <p>NAME URL</p> <p>stable <a href="https://kubernetes-charts.storage.googleapis.com" rel="noreferrer">https://kubernetes-charts.storage.googleapis.com</a></p> <p>local <a href="http://127.0.0.1:8879/charts" rel="noreferre...
uberrebu
<p>First, <strong>always</strong> update your local cache:</p> <pre><code>helm repo update </code></pre> <p>Then, you can list all charts by doing:</p> <pre><code>helm search repo </code></pre> <p>Or, you can do a case insensitive match on any part of chart name using the following:</p> <pre><code>helm search repo [you...
rouble
<p>How do I set the <code>client_max_body_size</code> parameter for a single subdomain? I have a server that will accept file uploads up to 5TB. All the examples I've looked at show you how to set it globally. I have multiple rules in my ingress.yaml, I don't want every single rule to inherit the <code>client_max_body_...
Eric Guan
<p>Because I don't see <code>client-max-body-size</code> on the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/" rel="nofollow noreferrer">list of annotations</a>, that leads me to believe you'll have to use the <a href="https://kubernetes.github.io/ingress-nginx/user-gui...
mdaniel
<p>I am running kube on a cluster of nodes. When i set the context on the cluster I get an error that says "error: You must be logged in to the server (Unauthorized)" when i try to run kubectl get pods </p> <p>If I unset the current-context the error goes away and i can view my pods and nodes. So my guess is it has so...
Chirrut Imwe
<blockquote> <p>If I unset the current-context the error goes away and i can view my pods and nodes. So my guess is it has something to do with my kubeconfig but I'm not sure where i got it wrong.</p> </blockquote> <p>That very likely means you are running <code>kubectl</code> on the master nodes themselves, and the...
mdaniel
<p>I am having one AWS EKS Cluster up &amp; running. I need to add node group with taint. So that I can deploy the pod on particular node group in EKS. I can do it in azure AKS using the following command.</p> <pre class="lang-bash prettyprint-override"><code>az aks nodepool add --resource-group rg-xx --cluster-name ak...
deepak
<p>You can use this example: <a href="https://eksctl.io/usage/autoscaling/#scaling-up-from-0" rel="nofollow noreferrer">https://eksctl.io/usage/autoscaling/#scaling-up-from-0</a></p> <pre><code>nodeGroups: - name: ng1-public ... labels: my-cool-label: pizza taints: feaster: &quot;true:NoSchedule&quot; </c...
pb100
<p>I'm upgrading my elasticsearch on kubernetes cluster from 5.6.10 to elasticsearch 6.1.4. However, I can't even get es 6.1.4 to launch. </p> <p>I keep getting the error <code>unknown setting [xpack.license.self_generated.type]</code>. </p> <p><a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.x/lice...
Mike
<p>As they are trying to communicate, you forgot to remove the configuration property from <code>config/elasticsearch.yml</code>. So, the full revised <code>command:</code> would be</p> <pre><code>~/bin/elasticsearch-plugin remove x-pack sed -i.bak -e /xpack.license.self_generated.type/d config/elasticsearch.yml elast...
mdaniel
<p>I'm struggling to understand the difference between Deployments and Pods in Kubernetes.</p> <blockquote> <p>A Deployment provides declarative updates for Pods and ReplicaSets.</p> </blockquote> <blockquote> <p>Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.</p> </blo...
Casper Dijkstra
<p>In short:</p> <p>With Pods</p> <ol> <li>if it dies it dies. Period.</li> <li>you can define only one copy of particular pod. If you need to have X copies you have to define in YAML file(s) X pods</li> <li>usually you will never see pods created directly in production environments. Too unreliable. Why ? because of 1....
pb100
<p>I am running a kubernetes cluter with 6 nodes (cluser-master &amp; kubernetes slave0-4) on "Bionic Beaver"ubuntu and I'm using Weave To install kubernetes I followed <a href="https://vitux.com/install-and-deploy-kubernetes-on-ubuntu/" rel="nofollow noreferrer">https://vitux.com/install-and-deploy-kubernetes-on-ubunt...
MatrixKiller420
<blockquote> <p><code>failed to find plugin "loopback" in path [/opt/cni/bin]</code></p> </blockquote> <p>As the helpful message is trying to explain to you, it appears you have a botched CNI installation. Anytime you see <code>FailedCreatePodSandBox</code> or <code>SandboxChanged</code>, it's always(?) related to a...
mdaniel
<p>I am running Mongodb pod in kunernetes cluster using nfs volume.I am writing pod.yml like this</p> <p><a href="https://i.stack.imgur.com/qPtlS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qPtlS.png" alt="enter image description here"></a></p> <p>but i am getting the below error<a href="https:...
BSG
<blockquote> <p>I am running Mongodb pod in kunernetes cluster using nfs volume.I am writing pod.yml like this</p> </blockquote> <p>Putting <code>mongo</code> in the <code>command:</code> is erroneous. The <strong>daemon</strong> is <code>mongod</code> and the image <a href="https://github.com/docker-library/mongo/b...
mdaniel
<p>I created my kubernetes cluster using KubeSpray on AWS. Now I am trying to get the Ingress Controller to work. My understanding is that I need to apply <a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.34.1/deploy/static/provider/aws/deploy.yaml" rel="nofollow noreferrer">https://raw...
David Medinets
<p>I have two answers to this question.</p> <p><strong>one</strong> - add the <code>cloud-provider</code> option to your <code>ansible-playbook</code> command as shown below.</p> <pre><code>ansible-playbook \ -vvvvv \ -i ./inventory/hosts \ ./cluster.yml \ -e ansible_user=centos \ -e cloud_provider=aws \ -e...
David Medinets
<p>Is it possible to use Kubespray with Bastion but on custom port and with agent forwarding? If it is not supported, what changes does one need to do?</p>
kboom
<p>Always, since you can configure that at three separate levels: via the host user's <code>~/.ssh/config</code>, via the entire playbook with <code>group_vars</code>, or as inline config (that is, on the command line or in the inventory file).</p> <p>The ssh config is hopefully straightforward:</p> <pre><code>Host 1...
mdaniel
<p>I am trying to start minikube behind a corporate proxy on Windows machine. I am using the following start command</p> <pre><code>minikube start --alsologtostderr --vm-driver="hyperv" --docker-env http_proxy=http://proxyabc.uk.sample.com:3128 --docker-env https_proxy=http://proxyabc.uk.sample.com:3128 --docker-env "...
Asif
<blockquote> <p><code>set NO_PROXY="$NO_PROXY,192.168.211.158/8443"</code></p> </blockquote> <p>That slash is not the port, it's the <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" rel="nofollow noreferrer">CIDR</a> which defines how many IPs should be excluded from the proxy. Separately, it a...
mdaniel
<p><strong>Some quick background:</strong> creating an app in golang, running on minikube on MacOS 10.14.2</p> <pre><code>karlewr [0] $ kubectl version Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-0...
rkarlewicz
<blockquote> <p>Why would my connection be getting refused only from the pod's IP?</p> </blockquote> <p>Because your program is apparently only listening on localhost (aka <code>127.0.0.1</code> aka <code>lo0</code>)</p> <p>Without knowing more about your container we can't advise you further, but that's almost cer...
mdaniel
<p>I'm trying to update an image in Kubernetes by using the following command:</p> <pre><code>kubectl set image deployment/ms-userservice ms-userservice=$DOCKER_REGISTRY_NAME/$BITBUCKET_REPO_SLUG:$BITBUCKET_COMMIT --insecure-skip-tls-verify </code></pre> <p>But when I receive the following error:</p> <pre><code>erro...
TietjeDK
<blockquote> <p>I have a suspicion that it has something to do with user - not much help from the error message.</p> </blockquote> <p>@TietjeDK is correct that it is just a misleading error message. It means one of two things is happening (or maybe both): the <code>kubectl</code> binary is newer than the supported v...
mdaniel
<p>I need to populate an env file located into pod filesystem filled by an init container previously.</p> <p>I look up <code>envFrom</code> <a href="https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/#_v1_envfromsource" rel="nofollow noreferrer">documentation</a> but I've not been able to f...
Jordi
<p>You will not be able to reference any filesystem component to populate an environment variable using the PodSpec, because it creates a chicken-and-egg problem: kubernetes cannot create the filesystem without a complete PodSpec, but it cannot resolve variables in the PodSpec without access to the Pod's filesystem</p>...
mdaniel
<p>Im having trouble invoking functions using kubeless. Here is the function spec</p> <pre><code>--- apiVersion: kubeless.io/v1beta1 kind: Function metadata: name: smk namespace: smktest spec: handler: hello.handler runtime: python2.7 function: | import json def handler(): return "...
smk
<blockquote> <p>When I try to call the function as below,</p> <p><code>kubeless function call smk</code></p> <p>I get</p> <p><code>FATA[0000] Unable to find the service for smk</code></p> <p>Running <code>kubeless function ls --namespace=smktest</code></p> </blockquote> <p>Then surely you would n...
mdaniel
<p>Is there any configuration snapshot mechanism on kubernetes?</p> <p>The goal is to take a snapshot of all deployments/services/config-maps etc and apply them to a kubernetes cluster.</p> <p>The steps that should be taken.</p> <ul> <li>Take a configuration snapshot</li> <li>Delete the cluster</li> <li>Create a new...
gkatzioura
<p>These are the 3 that spring to mind, with <code>kubed</code> being, at least according to their readme, the closest to your stated goals:</p> <ul> <li><a href="https://github.com/heptio/ark#readme" rel="nofollow noreferrer">Ark</a></li> <li><a href="https://github.com/appscode/kubed#readme" rel="nofollow noreferrer...
mdaniel
<p>I'm currently working on a traditional monolith application, but I am in the process of breaking it up into spring microservices managed by kubernetes. The application allows the uploading/downloading of large files and these files are normally stored on the host filesystem. I'm wondering what would be the most viab...
Matt Greene
<p>You have a bunch of different options, Googling your question you'll find many answers, for any budget and taste. Basically you'd want high-availability storage like AWS S3. You could setup your own dedicated server to store these files as well if you wanted to cut costs, but then you'd have to worry about backups a...
Denis Pshenov
<p>I stared my kubernetes cluster on AWS EC2 with kops using a private hosted zone in route53. Now when I do something like <code>kubectl get nodes</code>, the cli says that it can't connect to <code>api.kops.test.com</code> as it is unable to resolve it. So I fixed this issue by manually adding <code>api.kops.test.com...
Punit Naik
<p>Pragmatically speaking, I would add the public IP as a <code>IP</code> SAN to the master's x509 cert, and then just use the public IP in your kubeconfig. Either that, or the DNS record <em>not</em> in the private route53 zone.</p> <p>You are in a situation where you purposefully made things private, so now they are...
mdaniel
<p>have issue with </p> <pre><code>kubectl run -ti </code></pre> <p>in gitlab ci. For testing in CI we run docker container with "npm t" command in interactive mode and it was perfectly work on docker. After migrate to Kubernetes have issue, as kubectl run give next error: <code>Unable to use a TTY - input is not a ...
Alibek Karimov
<p>The <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#container-v1-core" rel="nofollow noreferrer">PodSpec <code>container:</code></a> has a <code>tty</code> attribute, which defaults to <code>false</code> but which one can set to <code>true</code> (that's what the <code>-t</code> option,...
mdaniel
<p>In <a href="https://github.com/kubernetes/client-go/blob/79cb21f5b3b1dd8f8b23bd3f79925b4fda4e2562/tools/cache/reflector.go#L100" rel="nofollow noreferrer">this</a> reflector package it mentions an unstable value being used as a name suffix. It's the number of nanoseconds modulo 12345. Is this meaningful or is it jus...
Brian
<p>The meaning seems clear:</p> <blockquote> <p><a href="https://github.com/kubernetes/client-go/commit/755bbca820db30c1a1d071d0ab4709fc49c003a5" rel="nofollow noreferrer">Kubernetes-commit: 1da4f4a745bf536c34e377321a252b4774d1a7e0</a></p> <p>tools/cache/reflector.go</p> <pre><code>// reflectorDisambiguator is...
peterSO
<p>I am able to scrape Prometheus metrics from a Kubernetes service using this Prometheus job configuration:</p> <pre><code>- job_name: 'prometheus-potapi' static_configs: - targets: ['potapi-service.potapi:1234'] </code></pre> <p>It uses Kubernetes DNS and it gives me the metrics from any of my three pods I use ...
Thomas Sundberg
<p>Here they use <a href="https://github.com/prometheus/prometheus/blob/v2.3.2/documentation/examples/prometheus-kubernetes.yml#L253-L256" rel="nofollow noreferrer"><code>example.io/scrape=true</code></a> (and similar annotations for specifying the <a href="https://github.com/prometheus/prometheus/blob/v2.3.2/documenta...
mdaniel
<p>I am running minikube on MacOS, and want to expose the ip address and port for running this example helm chart - <a href="https://docs.bitnami.com/kubernetes/how-to/create-your-first-helm-chart/" rel="nofollow noreferrer">https://docs.bitnami.com/kubernetes/how-to/create-your-first-helm-chart/</a></p> <p>I tried to...
joe the coder
<p>Because <code>minikube</code> is from the docker-machine family, running <code>minikube ip</code> will output the IP address of the virtual machine, and <strong>that</strong> is the IP upon which you should attempt to contact your cluster, not localhost.</p> <p>Furthermore, <code>[debug] Created tunnel using local ...
mdaniel
<p>I have a problem, I need to collect metric data from read-only-port located on 10255, but unfortunately by using netstat I found that such port don't exists at all. Can somebody help with advise, how could I create such port on kubelet or how can I avoid this port for data collection?</p>
volodjaklasik
<p>The <em>kubelet</em> requires a parameter to be set: <strong>--read-only-port=10255</strong> (<a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel="nofollow noreferrer">read more about kubelet</a>) </p> <p>If you are using <em>kubeadm</em> to bootstrap the cluster, you can use a ...
Adi Fatol
<p>I would like to know, which are the endpoints correctly configured for a certain ingress.</p> <p>For instance I have the following ingress:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Ingress metadata: name: dictionary spec: tls: - hosts: - dictionary.juan.com secretName: microsyn-secret ba...
juan garcia
<blockquote> <p>But then Why I get a 404?</p> </blockquote> <p>Ingress resources -- or certainly the one you showed in your question -- use virtual-host routing, so one must set the <code>host:</code> header when interacting with that URL:</p> <pre><code>curl -H 'host: dictionary.juan.com' http://192.168.99.100:312...
mdaniel
<p>How can we get the real resource usage (not resource requests) of each pod on Kubernetes by command line? Heapster is deprecated. Meanwhile, Metrics-server still does not support <code>kubectl top pod</code>.</p> <ol> <li><p>Heapster - </p> <p>I deployed Heapster using the following command </p> <pre><code>$ heap...
Tan Le
<blockquote> <p>Error from server (ServiceUnavailable): the server is currently unable to handle the request (get services http:heapster:)</p> </blockquote> <p>It sounds like the heapster deployment just forgot to install the <code>Service</code> for <code>heapster</code>; I would expect this would get you past <em>...
mdaniel
<p>I have a GKE k8s cluster and wanted to reboot one of the nodes (a vm reboot, and not just the kubelet).</p> <p>I was looking for the correct way (if there is one) than just resetting the vm directly. But I couldnt find anything in the web.</p> <p>So, my plan is to use these steps:</p> <ol> <li>drain the node</li> <l...
rrw
<p>No, that is the correct way -- and you don't have to <code>drain</code> the Node first unless there is some extenuating circumstance. One of the major features of kubernetes is that it will route around the "damage" of having a Node disappear suddenly.</p> <p>You <em>could</em> <code>cordon</code> the Node, if you ...
mdaniel
<p>I'm trying to deploy my web service to Google Container Engine:</p> <p>Here's my <strong>deployment.yaml:</strong></p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: handfree labels: app: handfree spec: replicas: 3 template: metadata: labels: app: handfree ...
Abdul Rehman
<blockquote> <p>Unknown user "client".</p> </blockquote> <p>Means there is no <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#rolebinding-v1-rbac-authorization-k8s-io" rel="nofollow noreferrer"><code>RoleBinding</code></a> or <a href="https://kubernetes.io/docs/reference/generated/kuber...
mdaniel
<p>I am looking for a static validator that validates Kubernetes deployment or service yaml files based on custom rules. For example, I can have a rule to disallow some fields in the yaml files (although they are valid fields in K8s), or specify a range for values of a field. The validation is triggered independent of ...
DylanS
<p>I believe the thing you are looking for is an <a href="https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/" rel="nofollow noreferrer">Admission Controller</a> and its two baked-in kinds "validating" and "mutating." However, as the docs say, if that's not powerful enough for your needs ther...
mdaniel
<p>I want to scale an application with workers.<br> There could be 1 worker or 100, and I want to scale them seamlessly.<br> The idea is using replica set. However due to domain-specific reasons, the appropriate way to scale them is for each worker to know its: ID and the total number of workers.</p> <p>For example, i...
nmiculinic
<p>Before giving the kubernetes-specific answer, I wanted to point out that it seems like the problem is trying to push cluster-coordination down into the app, which is almost by definition harder than using a distributed system primitive designed for that task. For example, if every new worker identifies themselves in...
mdaniel
<p>I am looking for a way to delete PersistentVolumeClaims assigned to pods of a StatefulSet automatically when I scale down the number of instances. Is there a way to do this within k8s? I haven't found anything in the docs, yet.</p>
alpe1
<p>I suspect that a <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#lifecycle-v1-core" rel="nofollow noreferrer"><code>preStop</code> Lifecycle Handler</a> could submit a <code>Job</code> to clean up the PVC, assuming the Pod's <code>ServiceAccount</code> had the <code>Role</code> to do so...
mdaniel
<p>Kubernetes automatically generates several environment variables for you, like <code>SERVICE1_SERVICE_HOST</code> and <code>SERVICE1_SERVICE_PORT</code>. I would like to use the value of these variables to set my own variables in the deployment.yml, like below:</p> <pre><code>env: - name: MY_NEW_VAR value: ${SERV...
DraegerMTN
<p>The syntax is <code>$(SERVICE1_SERVICE_HOST)</code>, as one can see in <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config" rel="nofollow noreferrer">the fine manual</a></p>
mdaniel
<p>We're planning to migrate our software to run in kubernetes with auto scalling, this is our current infrastructure:</p> <ol> <li>PHP and apache are running in Google Compute Engine n1-standard-4 (4 vCPUs, 15 GB memory)</li> <li>MySql is running in Google Cloud SQL</li> <li>Data files (csv, pdf) and the code are sto...
Jackson Tong
<blockquote> <p>Data files (csv, pdf) and the code are storing in a single SSD Persistent Disk</p> </blockquote> <p>There's nothing stopping you from volume mounting an SSD into the Pod so you can continue to use an SSD. I can only speak to AWS terminology, but some EC2 instances come with "local" SSD hardware, and ...
mdaniel
<p>I have Kubernetes cluster hosted in Google Cloud. I created a deployment and defined a hpa rule for it:</p> <pre><code>kubectl autoscale deployment my_deployment --min 6 --max 30 --cpu-percent 80 </code></pre> <p>I want to run a command that editing the <code>--min</code> value, <strong>without remove and re-creat...
No1Lives4Ever
<blockquote> <p>Is this possible to edit hpa (min, max, cpu-percent, ...) on command line?</p> </blockquote> <p>They are editable just as any other resource is, though either <code>kubectl edit hpa $the_hpa_name</code> for an interactive edit, or <code>kubectl patch hpa $the_hpa_name -p '{"spec":{"minReplicas": 1}}'...
mdaniel
<p>I am trying to implement CI/CD pipeline for my Spring Boot microservice deployment. Here I am planning to use Kubernetes and Jenkins for that. And I have one on-premise server which I am using for my SVN code repository. I am using SVN for version control. And also for keeping image registry, I am planning to use Do...
Mr.DevEng
<blockquote> <p>When I am adding the URL for SVN Dockerhub and credentials , Is possible to add these all in my Jenkinsfile ?</p> </blockquote> <p>Is it <strong>possible</strong>? Yes. Is it <strong>advisable</strong>? No. If for no other reason than it makes rotating credentials that much harder, since one would ne...
mdaniel
<p>I'm pretty new to Kubernetes, trying to figure it out. I haven't been able to google this answer tho, so I'm stumped. Can Kubernetes mount two secrets to the same path? say given the following deployment:</p> <pre><code>apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: ...
Evan R.
<blockquote> <p>would it be possible to mount both SSL certs to the same directory (/etc/nginx/ssl/*)?</p> </blockquote> <p>No, because (at least when using a docker runtime) it uses volume mounts, which behave exactly the same as <code>mount -t ext4 /dev/something /path/something</code> in that <code>/path/somethin...
mdaniel
<p>I work on a Kubernetes cluster based CI-CD pipeline. The pipeline runs like this:</p> <ul> <li>An ECR machine has Docker.</li> <li>Jenkins runs as a container.</li> <li>"Builder image" with Java, Maven etc is built.</li> <li>Then this builder image is run to build an app image(s)</li> <li>Then the app is run in kub...
Ondra Žižka
<p>I <em>believe</em> an <code>initContainer</code> would do that, provided it had access to <code>/var/run/docker.sock</code> (and your cluster allows such a thing) by conditionally pulling (or <code>docker load</code>-ing) the image, such that when the "main" <code>container</code> starts, the image will always be ca...
mdaniel
<p>I'm having trouble accessing a Kubernetes environment variable in my python app's init.py file. It appears to be available in other files, however. </p> <p>My init.py file includes this code <code>app.config.from_object(os.environ['APP_SETTINGS'])</code>. The value of <code>APP_SETTINGS</code> depends on my envir...
hugo
<blockquote> <p><code>werkzeug.utils.ImportStringError: import_string() failed for 'config.StagingConfig\n'. Possible reasons are:</code></p> </blockquote> <p>It very clearly shows you that the module name has a trailing newline character, which is a very, very, very common error for people who try to <code>echo som...
mdaniel
<p>I am trying to deploy my Docker images using Kubernetes orchestration tools.When I am reading about Kubernetes, I am seeing documentation and many YouTube video tutorial of working with Kubernetes. In there I only found that creation of pods, services and creation of that .yml files. Here I have doubts and I am addi...
Mr.DevEng
<ol> <li><p>My favorite way to create clusters is <a href="https://github.com/kubernetes-incubator/kubespray#readme" rel="nofollow noreferrer">kubespray</a> because I find <a href="https://github.com/ansible/ansible#readme" rel="nofollow noreferrer">ansible</a> very easy to read and troubleshoot, unlike more monolithic...
mdaniel
<p>I'm trying to make my life easier and am coding a bash script. One of these allows me to kube into a pod with postgres access, get the credentials I need, and run the interactive psql shell. </p> <p>However, upon running</p> <pre><code>kubectl &lt;flags&gt; exec $podname -- bash -c ' get_credentials &amp;&amp; psq...
Oliver
<blockquote> <p><code>kubectl &lt;flags&gt; exec $podname</code></p> </blockquote> <p>That <code>exec</code> is missing its <code>-i</code> and <code>-t</code> for <code>--stdin=true</code> and <code>--tty=true</code> to describe to kubernetes that you wish your terminal and the remote terminal to be associated with...
mdaniel
<p>I have a pod <code>test-1495806908-xn5jn</code> with 2 containers. I'd like to restart one of them called <code>container-test</code>. Is it possible to restart a single container within a pod and how? If not, how do I restart the pod?</p> <p>The pod was created using a <code>deployment.yaml</code> with:</p> <pre>...
s5s
<blockquote> <p>Is it possible to restart a single container</p> </blockquote> <p>Not through <code>kubectl</code>, although depending on the setup of your cluster you can "cheat" and <code>docker kill the-sha-goes-here</code>, which will cause kubelet to restart the "failed" container (assuming, of course, the rest...
mdaniel
<p>I have Kuberenetes cluster hosted in Google Cloud. </p> <p>I deployed my deployment and added an <code>hpa</code> rule for scaling. </p> <pre><code>kubectl autoscale deployment MY_DEP --max 10 --min 6 --cpu-percent 60 </code></pre> <p>waiting a minute and run <code>kubectl get hpa</code> command to verify my scal...
No1Lives4Ever
<blockquote> <p>If I changed the MINPODS parameter to "1" - why I still have 6 pods?</p> </blockquote> <p>I believe the answer is because of the <code>&lt;unknown&gt;/60%</code> present in the output. <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">The f...
mdaniel
<p>I am using Kubespray with Kubernetes 1.9</p> <p>What I'm seeing is the following when I try to interact with pods on my new nodes in anyway through kubectl. Important to note that the nodes are considered to be healthy and are having pods scheduled on them appropriately. The pods are totally functional.</p> <pre><...
Brando__
<blockquote> <p>What's going on?</p> </blockquote> <p>That name needs to be resolvable from your workstation, because for <code>kubectl logs</code> and <code>kubectl exec</code>, the API sends down the URL for the client to interact <em>directly</em> with the <code>kubelet</code> on the target Node (to ensure that a...
mdaniel
<h1>Context</h1> <p>I have a java application built as a docker image.</p> <p>The image is deployed in a k8s cluster.</p> <p>In the java application, I want to connect to the api server and save something in Secrets.</p> <p>How can I do that with k8s java client?</p> <h1>Current Attempts</h1> <p>The <a href="https://ku...
kevin807210561
<p>With the assumption that your Pod has a <code>serviceAccount</code> automounted -- which is the default unless you have specified otherwise -- the <a href="https://github.com/kubernetes-client/java/blob/client-java-parent-2.0.0/util/src/main/java/io/kubernetes/client/util/ClientBuilder.java#L119" rel="nofollow noref...
mdaniel
<p>Our customer uses internal network. We have k8s application, some yaml files need to download image from internet. I have a win10 computer and I could ssh internal server and access internet. How to download image and then upload to internal server?</p> <p>Some image download site would be:</p> <pre><code>chenliuj...
user84592
<blockquote> <p>How to download image and then upload to internal server?</p> </blockquote> <p>The shortest path to success is</p> <pre><code>ssh the-machine-with-internet -- 'bash -ec \ "docker pull quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.15.0 ; \ docker save quay.io/kubernetes-ingres...
mdaniel
<p>I have a question regarding what is the best approach with K8S in AWS.</p> <p>the way I see it that either I use the EBS directly for PV AND PVC or that I mount the EBS as a regular folder in my EC2 and then use those mounted folders for my PV and PVC.</p> <p>what approach is better in your opinion? it is importan...
eran meiri
<blockquote> <p>what approach is better in your opinion?</p> </blockquote> <p>Without question: using the PV and PVC. Half the reason will go here, and the other half below. By declaring those as <em>managed resources</em>, kubernetes will cheerfully take care of attaching the volumes to the Node it is scheduling th...
mdaniel
<p>I do understand RBAC and I'm able to create a role using rules en subjects, bind them with a user.</p> <p>For example this role can only list the pods</p> <pre><code>kind: Role apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: namespace: development name: list-pods rules: - apiGroups: [""] # "" indicates...
DenCowboy
<blockquote> <p>Now how do I have to provide this role to users in different namespaces?</p> </blockquote> <p>You do if you want to be able to constrain the ability to list <code>Pod</code>s for that <code>Subject</code> on a per <code>Namespace</code> basis. For example, you might not want people to be able to see ...
mdaniel
<p>I have a dockerfile that looks like this at the moment:</p> <pre><code>FROM golang:1.8-alpine COPY ./ /src ENV GOOGLE_CLOUD_PROJECT = "snappy-premise-118915" RUN apk add --no-cache git &amp;&amp; \ apk --no-cache --update add ca-certificates &amp;&amp; \ cd /src &amp;&amp; \ go get -t -v cloud.google.co...
lightweight
<blockquote> <p>I want to be able to set the environment variables in the pod config so that the docker file can use those...how do I do that instead of just coding them into the docker image directly?</p> </blockquote> <p>There is no need to specify <strong>any</strong> <code>ENV</code> directive in a Dockerfile; t...
mdaniel
<p>We have multiple development teams who work and deploy their applications on kuberenetes. We use helm to deploy our application on kubernetes.</p> <p>Currently the challenge we are facing with one of our shared clusters. We would like to deploy tiller separate for each team. So they have access to their resources. ...
Tarun Prakash
<blockquote> <p>I would want to deploy tiller which has permission to work with resources exist or need to be created in these namespaces</p> </blockquote> <p>According to <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding" rel="nofollow noreferrer">the fine man...
mdaniel
<p>Done according to <a href="https://kubernetes.io/docs/tasks/administer-cluster/setup-ha-etcd-with-kubeadm/" rel="nofollow noreferrer">this article</a>.</p> <p>I installed Kubernetes. Then installed etcd cluster that works via HTTPS and listens to the localhost interface only (reachable from inside any Docker contai...
Michael A.
<p>I have no idea why they didn't surface the "cannot read the <code>-cert</code> file" error, but you specified <code>/etc/kubernetes/pki/etcd/server.crt</code> in the options but did not volume mount <code>/etc/kubernetes/pki</code> into the container. For obvious reasons, kubernetes will not <em>automatically</em> v...
mdaniel
<p>I'm having a dockerfile that runs fine with CentOS as a baseimage and enabled systemd, as suggested on CentOS official docker hub image documentation - <a href="https://hub.docker.com/_/centos/" rel="nofollow noreferrer">https://hub.docker.com/_/centos/</a>.</p> <p>I'll have to start my container using this followi...
Sidd Thota
<p>According to <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-pod" rel="nofollow noreferrer">the fine manual</a>, if you provide <code>command:</code> it supersedes <code>ENTRYPOINT</code>, and <code>args:</code> sup...
mdaniel