Question
stringlengths
65
39.6k
QuestionAuthor
stringlengths
3
30
Answer
stringlengths
38
29.1k
AnswerAuthor
stringlengths
3
30
<p>I have a Kubernetes controller written using client-go <a href="https://pkg.go.dev/k8s.io/client-go/informers" rel="nofollow noreferrer">informers</a> package. It maintains a watch on all Pods in the cluster, there are about 15k of these objects, and their YAML representation takes around 600 MB to print (I assume t...
ahmet alp balkan
<p>It appears that today if you use <a href="https://pkg.go.dev/k8s.io/client-go/informers#SharedInformerFactory" rel="nofollow noreferrer">SharedInformers</a>, there's no way to filters which objects to keep in the shared cache and which ones to discard.</p> <p>I have found an <a href="https://github.com/kubernetes/ku...
ahmet alp balkan
<p>I'm trying to deploy Traefik as an ingress controller on my GKE cluster. It's a basic cluster with 3 nodes.</p> <p>I'm used to deploy Traefik using manifest on a Kubernetes cluster deployed by Kubespray, but we are migrating some of our infrastructures to GCP.</p> <p>So I tried to deploy Traefik using the <a href=...
Kévin Printz
<pre><code>Invalid value for field 'namedPorts[0].port': '0' </code></pre> <p>This error happens when the <code>Service</code> that's being used by GKE Ingress is of type <code>ClusterIP</code> (and not <code>NodePort</code>). GKE Ingress requires backing Services to be of type NodePort.</p>
ahmet alp balkan
<p>When I have a multi zone GKE cluster, the num-nodes run in each zone for my node pools.</p> <p>GKE uses <em>zonal</em> instance groups, one in each zone for my cluster's zones.</p> <p>It seems like this could be implemented with a <em>regional</em> instance group instead.</p> <p>It seems that GKE Node Pools and R...
Charlie Egan
<p>As the other comment says this questions is not really suitable for Stack Overflow. It's an implementation detail of GKE –and not an important one to a user in practice.</p> <p>I work at Google (but I don't know the implementation details), but my guess would be because GKE needs to choose which 3 zones in a region...
ahmet alp balkan
<p>I have a gce airflow (composer) cluster with a bunch of workers:</p> <pre><code>$ kubectl get pods NAME READY STATUS RESTARTS AGE airflow-redis-0 1/1 Running 0 7h airflow-scheduler 2/2 Running 0 7h air...
CaffeineAddiction
<p>Deployment, by definition, uses a set of identical replicas as pods (i.e. ReplicaSet). Therefore all pods of a deployment will have the PodSpec, pointing to the same volume.</p> <p>Sounds like you need to write some custom logic yourself to orchestrate spinning up new workloads (i.e. Jobs) with different volumes.</...
ahmet alp balkan
<p>TL/DR:</p> <ol> <li>I don't know if I'm using the asynchronous programming features of C# and Blazor correctly.</li> <li>Even though things technically work, I'd like some guidance if I'm doing things correctly.</li> <li>Also, I'm having issues trying to get my &quot;loading spinner&quot; to work. What am I doing wr...
wtfacoconut
<p>I can spot a few issues. Always avoid <code>async void</code>.</p> <pre class="lang-cs prettyprint-override"><code>async Task GetNodesAsync() { spin = true; //Task.Delay(1500).Wait(); -- .Wait() blocks the UI await Task.Delay(1500); //await InvokeAsync(GetNodes); -- this won't run on another Th...
H H
<p>When I make request for this started server: <a href="https://gist.github.com/Rasarts/1180479de480d7e36d6d7aef08babe59#file-server" rel="nofollow noreferrer">https://gist.github.com/Rasarts/1180479de480d7e36d6d7aef08babe59#file-server</a></p> <p>I get right response:</p> <pre><code>{ "args": {}, "headers": { ...
Vitaliy Vostrikov
<p>Knative uses <a href="https://istio.io" rel="nofollow noreferrer">Istio</a> and Istio, by default, doesn't allow outbound traffic to external hosts, such as httpbin.org. That's why your request is failing.</p> <p>Follow <a href="https://github.com/knative/docs/blob/f31d7106a119b453b0dbf208c3b1c0d698af4323/serving/o...
ahmet alp balkan
<p>I am trying to follow tutorial of Kubernetes but I am kinda lost on first steps when trying to use Katacoda... When I just try to open minikube dashboard I encounter error:</p> <blockquote> <p>failed to open browser: exec: "xdg-open": executable file not found in $PATH</p> </blockquote> <p>and dashboard itself r...
Tomasz Kapłoński
<p>Founder of Katacoda here. When running locally, then xdg provides the wrapper for opening processes on your local machine and installing the package would resolve the issue. As Katacoda runs everything within a sandbox, we cannot launch processes directly on your machine. </p> <p>We have added an override for xdg-o...
Ben Hall
<p>We have several microservices implemented in Java/Kotlin and Spring MVC, running in Tomcat docker images. These services provide public APIs which are authenticated by user's cookies/sessions. These work correctly.</p> <p>Now, we would like to create an internal endpoint, which wouldn't be accessible either outside...
Vojtěch
<p>Your question isn't GKE specific. It's broadly a Kubernetes question.</p> <p>I encourage you to search Kubernetes service authentication.</p> <p>There are many ways to do this, including rolling your own auth model. One feature that can help here is Kubernetes NetworkPolicy resource (it's like firewalls), you can ...
ahmet alp balkan
<p>The application inside the container is inaccessible from the outside i.e if I exec into the docker container and do </p> <pre class="lang-sh prettyprint-override"><code>curl localhost:5000 </code></pre> <p>it works correctly but not on the browser in my computer i get error : This site cant be reached</p> <p>My...
cosmicsage
<p>By default, 127.0.0.1 means a different thing inside the container than it does outside. Use <code>0.0.0.0:5000</code> instead.</p>
Dave W. Smith
<p>I want to delete namespace and all resources under it.</p> <p>So i ran</p> <pre><code>% kubectl delete namespace observability namespace &quot;observability&quot; deleted </code></pre> <p>but this command was stuck, when I checked the namespace status it was showing <code>Terminating</code></p> <pre><code>$ kubectl ...
roy
<p>Looks like there is something wrong with your metrics-server. Check to see if its up and try to resolve that root cause <code>kubectl -n kube-system get pods | grep metrics-server</code>. See <a href="https://github.com/kubernetes-sigs/metrics-server" rel="nofollow noreferrer">https://github.com/kubernetes-sigs/me...
Scott Schulthess
<p>We use Google Cloud Run on our K8s cluster on GCP which is powered by Knative and Anthos, however it seems the load balancer doesn't amend the x-forwarded-for (and this is not expected as it is TCP load balancer), and Istio doesn't do the same.</p> <p>Do you have the same issue or it is limited to our deployment? I ...
KimDai
<p>I think you are correct in assessing that current Cloud Run for Anthos set up (unintentionally) does not let you see the origin IP address of the user.</p> <p>As you said, the created gateway for Istio/Knative in this case is a Cloud Network Load Balancer (TCP) and this LB doesn’t preserve the client’s IP address on...
ahmet alp balkan
<p>I'm mounting a local folder into minikube and using that folder inside a pod. The folder contains the code I am developing. It works great but changes I make are not being reflected in the browser. If I exec into the pod I can see my code changes, just not in the browser. </p> <p>If I delete the pod when it is auto...
prime
<p>Have a look at <a href="https://github.com/GoogleContainerTools/skaffold/" rel="nofollow noreferrer">Skaffold</a> — and its <a href="https://github.com/GoogleContainerTools/skaffold/blob/master/examples/annotated-skaffold.yaml" rel="nofollow noreferrer"><code>sync</code></a>; it ensures your yaml files are running i...
Henrik
<p>I have just been certified CKAD (Kubernetes Application Developer) by The Linux Foundation.</p> <p>And from now on I am wondering : is RabbitMQ queueing system unnecessary in a Kubernetes cluster ?</p> <p>We use workers with queueing system in order to avoid http 30 seconds timeout : let's say for example we have a ...
Thomas Aumaitre
<blockquote> <p>But in a Kubernetes cluster by default there is no timeout for http request going inside the cluster.</p> </blockquote> <p>Not sure where you got that idea. Depending on your config there might be no timeouts at the proxy level but there's still client and server timeouts to consider. Kubernetes doesn't...
coderanger
<p>I have got a Google Cloud IAM service account key file (in json format) that contains below data.</p> <pre><code>{ "type": "service_account", "project_id": "****", "private_key_id":"****", "private_key": "-----BEGIN PRIVATE KEY----blah blah -----END PRIVATE KEY-----\n", "client_email": "*****", "client_id": "****",...
bms
<p>This answer provides some guidance: <a href="https://stackoverflow.com/questions/48400966/access-kubernetes-gke-cluster-outside-of-gke-cluster-with-client-go/48412272#48412272">Access Kubernetes GKE cluster outside of GKE cluster with client-go?</a> but it's not complete.</p> <p>You need to do two things:</p> <ol...
ahmet alp balkan
<p>My Kubernetes on AKS is using one resource group to inform their costs.</p> <p>At this moment we have many projects in the company, will be great if each POD report their costs to a different resource group named as the project.</p> <p>How can I do this?</p>
Newton Pasqualini Filho
<p>You'll need to implement an intra-cluster cost tool.</p> <p>The most popular in the kubernetes ecosystem is kubecost, and they have recently release and OSS version, OpenCost. <a href="https://www.opencost.io/" rel="nofollow noreferrer">https://www.opencost.io/</a></p> <p>Typically you'd create a namespace for each ...
GordonBy
<p>I have a very basic question about Argo. Apologies if this is triggering.</p> <p>From my understanding, Argo is an extension to the Kubernetes API via being a &quot;Resource&quot; i.e it is invoked by &quot;kubectl argo xyz&quot; i.e endpoint is argo. instead of the endpoint being a pod etc. Each resource has object...
Shivam Anand
<p>Argo Workflows is an operator, it's a daemon you deploy into your cluster so it has to run actual code. And the only way you do that is with a pod.</p>
coderanger
<p>I am trying to create a housekeeping job where I erase namespaces that have not been used for seven days. I have two options:</p> <ol> <li>I can use a Job, but I don't know how to make sure the Jobs are running on the date that I want.</li> <li>I read about <a href="https://stackoverflow.com/questions/5473780/how-t...
irvifa
<p>Kubernetes CronJob API is very similar to cron as you said and doesn't have a year field.</p> <p>If you need something that gets scheduled on time, you should write a kubernetes controlller that waits until the date you want, and then calls into Kubernetes API to create a <strong>Job</strong> object. This shouldn...
ahmet alp balkan
<p>I'm using the handy <code>kubectl logs -l label=value</code> command to get log from all my pods matching a label. I want to see which pod outputted what log, but only the log text is displayed. Is there a way to control the log format, or a command argument which will let me do this?</p>
Dhiraj Gupta
<p><code>kubectl</code> now has a <code>--prefix</code> option that allows you to prefix the pod name before the log message.</p>
Erik L
<p>I've got several gRPC microservices deployed via Istio in my k8s pod behind a gateway that handles the routing for web clients. Things work great when I need to send an RPC from client (browser) to any of these services.</p> <p>I'm now at the point where I want to call service A from service B directly. How do I g...
codedread
<p>Ok, at least the root cause of the &quot;Channel credentials must be a ChannelCredentials object&quot; error is now known. I'm developing node packages side-by-side as symlinks and each of the dependencies has their own copy of grpc-js in it.</p> <p><a href="https://github.com/npm/npm/issues/7742#issuecomment-25718...
codedread
<p>I'm trying to give a group of users permission to scale a specific set of deployments in kubernetes 1.20</p> <p>I've tried using the API reference doc here: <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#patch-scale-deployment-v1-apps" rel="nofollow noreferrer">https://kubernetes.io/do...
conmanworknor
<p><code>resources</code> isn't what you're looking for, it's <code>resourceNames</code> which has to be a specific object name like <code>resourceNames: [my-deployment-name]</code>. In general this isn't a very good approach, the expectation is that you will segment things by namespace and give them permissions in jus...
coderanger
<p>I've added a second TCP port to my Kubernetes service, and have noticed that which port kubelet assigns to the <code>{SVCNAME}_SERVICE_PORT</code> <a href="https://kubernetes.io/docs/concepts/services-networking/service/#environment-variables" rel="nofollow noreferrer">environment variable</a> appears to be order de...
Roddy of the Frozen Peas
<p>In older Kubernetes versions, a Service can define only a single port. When they added support for multiple ports, they chose by design to put the <a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/envvars/envvars.go#L47" rel="nofollow noreferrer">first port in the backwards compatible environ...
Chin Huang
<h1>Scenario</h1> <p>I'm using the <a href="https://martinfowler.com/bliki/CQRS.html" rel="nofollow noreferrer">CQRS pattern</a> for REST services that deal with Sales as in the diagram below. (The question focuses on the REST services.)</p> <p><a href="https://i.stack.imgur.com/be2mZ.jpg" rel="nofollow noreferrer"><im...
Paulo Merson
<p>I think it is better to route based on the URL (like <strong>/queries/xxxx</strong> and <strong>/commands/xxxx</strong>) and not on the HTTP verb/method because it might be useful to be able to do GET requests to the command service.</p> <p>For example, you might want to do GET requests to the /health endpoint for h...
Tore Nestenius
<p>Let's say that I have a running pod named <code>my-pod</code></p> <p><code>my-pod</code> reads the secrets from <code>foobar-secrets</code></p> <p>Now let's say that I update some value in <code>foobar-secrets</code></p> <pre><code>kubectl patch secret foobar-secrets --namespace kube-system --context=cluster-1 --pat...
Rodrigo
<p><a href="https://github.com/stakater/Reloader" rel="nofollow noreferrer">https://github.com/stakater/Reloader</a> is the usual solution for a fully standalone setup. Another option is <a href="https://github.com/jimmidyson/configmap-reload" rel="nofollow noreferrer">https://github.com/jimmidyson/configmap-reload</a>...
coderanger
<p>Is there any way to run <code>kubectl proxy</code>, giving it a command as input, and shutting it down when the response is received?</p> <p>I'm imagining something with the <code>-u</code> (unix socket) flag, like this:</p> <pre><code>kubectl proxy -u - &lt; $(echo "GET /api/v1/namespaces/default") </code></pre> ...
philo
<p>You don't need a long-running <code>kubectl proxy</code> for this.</p> <p>Try this:</p> <pre><code>kubectl get --raw=/api/v1/namespaces/default </code></pre>
ahmet alp balkan
<p>We have a bunch of pods that use RabbitMQ. If the pods are shut down by K8S with SIGTERM, we have found that our RMQ client (Python Pika) has no time to close the connection to RMQ Server causing it to think those clients are still alive until 2 heartbeats are missed.</p> <p>Our investigation has turned up that on S...
Spanky
<p>TERM kills nothing, it's up to your application to decide how to handle it. SIGKILL is sent some time later which does forcibly nuke the process but 1) it also closes all sockets which RMQ can detect and 2) you control how long the container has to close cleanly via terminationGracePeriodSeconds</p>
coderanger
<p>Is it possible to create a Cloud Run on GKE (Anthos) Kubernetes Cluster with Preemptible nodes and if so can you also enable plugins such as gke-node-pool-shifter and gke-pvm-killer or will it interfere with cloud run actions such as autoscaling pods</p> <p><a href="https://hub.helm.sh/charts/rimusz/gke-node-pool-...
john_taylor
<p>Technically a Cloud Run on GKE cluster is still a GKE cluster at the end of the day, so it can have preemptive node pools.</p> <p>However, some Knative Serving components, such as the <code>activator</code> and <code>autoscaler</code> are in the hot path of serving the requests. You need to make sure they don't end...
ahmet alp balkan
<p>SSH to GKE node private IP from the jump server (Bastion host) is not working.</p> <p>I even tried the following as suggested by one of my friends, but it did not help.</p> <pre><code>gcloud compute instances add-metadata $INSTANCE_NAME_OR_INSTANCE_ID --metadata block-project-ssh-keys=false --zone $YOUR_VM_ZONE --...
k_vishwanath
<p>GKE node is just a GCE VM. You can just access it as a normal GCE instance if with proper privilege and ssh key configured.</p> <p>One thing worth to mention that <a href="https://cloud.google.com/iap/docs/using-tcp-forwarding#tunneling_with_ssh" rel="nofollow noreferrer">GCP support IAP based ssh port forwarding</...
Sam Liao
<p>I'm running the leader-elector (v0.5) as a sidecar on three pods, on three different nodes. </p> <p>Arguments: --election=XXX --http=0.0.0.0:4040</p> <p>All works well until I kill the leader pod. </p> <p>Now I get one of the pods into a state where the logs say it switched to the new leader:</p> <pre><code>kube...
Fredrik Jansson
<p>Yes, bug. I've uploaded a fixed container here: <a href="https://hub.docker.com/r/fredrikjanssonse/leader-elector/tags/" rel="nofollow noreferrer">https://hub.docker.com/r/fredrikjanssonse/leader-elector/tags/</a></p>
Fredrik Jansson
<p>I am currently running a deployment that is pulling from a database and is set as read only. Unfortunately the deployment freezes on coaction without notice so I came up with the idea of having the code write to a log file and have the liveness probe check to see if the file is up to date.</p> <p>This has been teste...
boblerbob
<p><code>allowedHostPaths</code> is related to hostPath volume mounts (aka bind-mounting in folder from the host system). Nothing to do with stuff inside the container image. What you probably want is <code>readOnlyRootFilesystem: true</code> like you have now plus an emptyDir volume mounted at <code>/code/logs</code> ...
coderanger
<p>I have the following CSR object in Kubernetes:</p> <pre><code>$ kubectl get csr NAME AGE REQUESTOR CONDITION test-certificate-0.my-namespace 53m system:serviceaccount:my-namespace:some-user Pending </code></pre> <p>And ...
licorna
<p>Here's to answer my question based on @jaxxstorm answer and my own investigation:</p> <pre><code># Import required libs and configure your client from datetime import datetime, timezone from kubernetes import config, client config.load_kube_config() # this is the name of the CSR we want to Approve name = 'my-csr' ...
licorna
<p>I recently installed <strong>FluxCD 1.19.0</strong> on an <strong>Azure AKS</strong> k8s cluster using <strong>fluxctl install</strong>. We use a private git (<strong>self hosted bitbucket</strong>) which Flux is able to reach and check out. </p> <p>Now Flux is not applying anything with the error message:</p> <pr...
Michael Niemand
<p>The problem was with the version of kubectl used in the 1.19 flux release, so I fixed it by using a prerelease: <a href="https://hub.docker.com/r/fluxcd/flux-prerelease/tags" rel="nofollow noreferrer">https://hub.docker.com/r/fluxcd/flux-prerelease/tags</a></p>
Michael Niemand
<p>So I have an Helm template:</p> <pre><code> spec: containers: - name: {{ .Values.dashboard.containers.name }} image: {{ .Values.dashboard.containers.image.repository }}:{{ .Values.dashboard.containers.image.tag }} imagePullPolicy: Always env: - name: BASE_PA...
Matteo
<p>Just remove the <code>env:</code> from your bit.</p> <pre><code> env: - name: BASE_PATH value: /myapp/web {{- if .Values.extraEnvs}} {{- range .Values.extraEnvs }} - name: {{ .name }} value: {{ .value }} {{- end }} ...
coderanger
<p>Assuming I have a Kubernetes Deployment object with the <code>Recreate</code> strategy and I update the Deployment with a new container image version. Kubernetes will:</p> <ol> <li>scale down/kill the existing Pods of the Deployment,</li> <li>create the new Pods,</li> <li>which will pull the new container images</li...
Fabian Schmied
<p>Via <a href="https://www.reddit.com/r/kubernetes/comments/oeruh9/can_kubernetes_prepull_and_cache_images/" rel="nofollow noreferrer">https://www.reddit.com/r/kubernetes/comments/oeruh9/can_kubernetes_prepull_and_cache_images/</a>, I've found these ideas:</p> <ul> <li>Implement a DaemonSet that runs a &quot;sleep&quo...
Fabian Schmied
<p>I need to find out if all deployments having label=a is in READY state? Example is below. I need to return true or false based on wether all deployments are in READY or NOT ready? I can parse text but I think there might be a more clever way with just kubectl and json path or something</p> <pre><code>PS C:\Users\art...
Gregory Suvalian
<p>Add <code>-o yaml</code> to see the YAML objects for each, which you can then use to build a <code>-o jsonpath</code> like <code>-o jsonpath='{range .items[*]}{.status.conditions[?(@.type == &quot;Available&quot;)].status}{&quot;\n&quot;}{end}'</code>. You can't do logic operations in JSONPath so you'll need to filt...
coderanger
<p>There's <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#server-tokens" rel="nofollow noreferrer">a setting</a> to turn off the NGINX Server header, but I'm new to Kubernetes and Helm so I don't actually know how to set it.</p> <p>I've tried to turn off server tokens lik...
mpen
<p><del>I think it has to be a capital F in <code>False</code>.</del> Doesn't need to be. It just wasn't taking before. I don't know why. <a href="https://github.com/nginxinc/kubernetes-ingress/issues/226#issuecomment-391183286" rel="nofollow noreferrer">This</a> and <a href="https://github.com/nginxinc/kubernetes-ingr...
mpen
<p>When I tries create pod from docker images, I get create container error. Here is my pod.yml file</p> <pre><code>apiVersion: v1 kind: Pod metadata: name: client spec: containers: - image: es-tutorial_web imagePullPolicy: Never name: es-web ports: - containerPort: 3000 - image: ...
Akashii
<p>I believe you're missing <a href="https://docs.docker.com/engine/reference/builder/#cmd" rel="nofollow noreferrer"><code>CMD</code></a> or <a href="https://docs.docker.com/engine/reference/builder/#entrypoint" rel="nofollow noreferrer"><code>ENTRYPOINT</code></a> in your <code>Dockerfile</code>. They're required to ...
kenorb
<pre><code>Kubectl get cs -o ymal </code></pre> <p>returns the healthy status for the control plane, but due some some reason,</p> <pre><code>kubectl get pods --all-namespaces </code></pre> <p>does not show any control plane pods like api-server, schedular, controller manager etc.</p> <p>I can also see the manifest fil...
Pragmatic
<p>GKE does not run the control plane in pods. Google does not really talk about how they run it but it's likely as containers in some GKE-specific management system.</p>
coderanger
<p>I've found 2 different ways to run a one-off command in my kubernetes cluster:</p> <h2>Method 1</h2> <pre><code>kubectl apply -f kubernetes/migrate.job.yaml kubectl wait --for=condition=complete --timeout=600s job/migrate-job kubectl delete job/migrate-job </code></pre> <p>The problem with this is (a) it doesn't ...
mpen
<p>There's an open ticket for this: <a href="https://github.com/kubernetes/kubernetes/issues/63214" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/63214</a></p> <p>A short term solution is to run your job like this:</p> <pre><code>kubectl run migrate --stdin --tty --rm --restart=Never --ima...
mpen
<p>I have a spring boot web app which simply prints a property that is passed in a Kubernetes' ConfigMap.</p> <p>This is my main class:</p> <pre><code>@SpringBootApplication @EnableDiscoveryClient @RestController public class DemoApplication { private MyConfig config; private DiscoveryClient discoveryClient;...
Miguel Ribeiro
<p>The <a href="https://github.com/spring-cloud/spring-cloud-kubernetes/blob/master/README.adoc#kubernetes-propertysource-implementations" rel="noreferrer">Spring Cloud Kubernetes documentation</a> is incomplete. It lacks the instruction to include this dependency to enable loading application properties from ConfigMap...
Chin Huang
<p>Hi guys I have an error and I can't find the answer. I am trying to deploy a very simple MySQL deployment:</p> <pre><code>apiVersion: apps/v1 kind: Deployment metadata: labels: app: mysql name: mysql spec: replicas: 1 selector: matchLabels: app: mysql template: metadata: labels: ...
Iurie Muradu
<p>Answered in comments, the password was corrupted which threw off the setup scripts.</p>
coderanger
<p>My node.js kubernetes dev server is stuck in a crash loop. The logs show:</p> <pre><code>/bin/busybox:1 ELF ^ SyntaxError: Invalid or unexpected token at wrapSafe (internal/modules/cjs/loader.js:992:16) at Module._compile (internal/modules/cjs/loader.js:1040:27) at Object.Module._extensions..js (internal...
mpen
<p>It was the single quotes I used in the <code>CMD</code>.</p> <p>Found this reddit post after the fact: <a href="https://www.reddit.com/r/docker/comments/9wn5gw/be_aware_of_the_quotes_in_your_dockerfile/" rel="nofollow noreferrer">https://www.reddit.com/r/docker/comments/9wn5gw/be_aware_of_the_quotes_in_your_dockerfi...
mpen
<p>I've created the following sample program which I need to create secret values</p> <p>index.js</p> <pre><code>const express = require(&quot;express&quot;); const port = process.env.PORT || 3000; app = express(); app.get('/', (req, res) =&gt; ( res.send(&quot;hello from k8s&quot;)) ) app.listen(3000, function ...
Beno Odr
<p>The <code>name</code> is the key for the env var so with what you have, that should be <code>process.env.myenv</code>. You probably instead want to use the <code>envFrom</code> option.</p>
coderanger
<p>I am getting metrics exposed by kube-state-metrics by querying Prometheus-server but the issue is I am getting duplicate metrics with difference only in the job field. . I am doing query such as :</p> <pre><code>curl 'http://10.101.202.25:80/api/v1/query?query=kube_pod_status_phase'| jq </code></pre> <p>The only dif...
S4H
<p>You are running (or at least ingesting) two copies of kube-state-metrics. Probably one you installed and configured yourself and another from something like kube-prometheus-stack?</p>
coderanger
<p>I am trying to enable the local account on an AKS cluster (version 1.24.10) by running commands from an AzureDevOps yaml pipeline.</p> <p>The “old” az aks command : <code>az aks update -g &lt;myresourcegroup&gt; -n &lt;myclustername&gt; --enable-local</code> used to serve me well to enable a local account on an AKS...
Morné Kruger
<p>Wow, great spot... The enable flag isn't there. You might want to raise this on the <a href="https://github.com/Azure/azure-powershell/discussions/categories/feature-requests" rel="nofollow noreferrer">Azure PowerShell GitHub</a>.</p> <p>As a workaround, the Azure CLI does allow enabling of local accounts.</p> <pre ...
GordonBy
<p>I'm trying to create some reusable Terraform modules that provision Kubernetes resources on a cluster. My modules do not explicitly configure a Kubernetes provider, expecting that a configured one will be created by the "root" module. I believe this is in line with <a href="https://www.terraform.io/docs/configuratio...
AwesomeTown
<p>The best option I've come up with is to create a Kubernetes provider in the module like:</p> <pre><code># Prevents this module from loading a default context from local kubeconfig when calling module forgets to define a Kubernetes provider provider "kubernetes" { load_config_file = false } </code></pre> <p>Then,...
AwesomeTown
<p>How can I trigger the update (redeploy) of the hearth through the k8s golang client.</p> <p>At the moment, I use these libraries to get information about pods and namespaces:</p> <pre><code>v1 &quot;k8s.io/api/core/v1 k8s.io/apimachinery/pkg/apis/meta/v1 k8s.io/client-go/kubernetes k8s.io/client-go/rest </code></pre...
mide
<p>The standard way to trigger a rolling restart is set/update an annotation in the pod spec with the current timestamp. The change itself does nothing but that changes the pod template hash which triggers the Deployment controller to do its thang. You can use <code>client-go</code> to do this, though maybe work in a l...
coderanger
<p>I have a deployment with multiple pods in Azure Kubernetes Service.<br> There is a K8s service that is used to connect deployment pods.<br> The service has a private IP accessible in Azure Virtual Network. The service type is LoadBalancer.<br> I want to monitor and see if the service is up. If it is not up, trigger ...
Fuat Ulugay
<p>Using Azure Application Insights there are two [private monitoring options] (<a href="https://learn.microsoft.com/en-us/azure/azure-monitor/app/availability-private-test" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/azure-monitor/app/availability-private-test</a>) described.</p> <ol> <li>Allowin...
GordonBy
<p>I just ran through the <code>JHipster</code> demo &quot;Learn JHipster In 15 Minutes&quot; and I'm now trying to deploy the result into kubernetes using <a href="https://www.jhipster.tech/kubernetes/" rel="nofollow noreferrer">these instructions</a>. It's failing on the 2nd question.</p> <pre><code>$ jhipster kubern...
John Aronson
<p>I believe you need to create it at the same level as your monolith. For example:</p> <ul> <li>JHipDemo</li> <li>k8s</li> </ul> <p>Can you try this?</p>
Matt Raible
<p>we have pods on <a href="https://cloud.google.com/kubernetes-engine" rel="nofollow noreferrer">GKE</a>.</p> <p>we can delete pod by <code>kubectl -n &lt;ns&gt; delete pod &lt;pod name&gt;</code>. we can also delete the pod by clicking the following delete button.</p> <p><a href="https://i.stack.imgur.com/ZYP6o.png" ...
BAE
<p>Both trigger the same API call to the kube-apiserver. If you try to delete something twice, the second call will fail either &quot;already deleted&quot; or &quot;not found&quot;.</p>
coderanger
<p>I have setup a Kubernetes cluster with a few VMs. I know the external static IP of each node. Is there a way for me to manually register these external IPs to my cluster nodes?</p> <p>I don't want to use Service, Ingress, MetalLB, or any cloud-specific load balancer solution.</p> <p>Basically, I want to manually pop...
Arash Motamedi
<p>Okay, so to rewind, this is what the actual data structure looks like:</p> <pre><code> addresses: - address: 10.45.0.53 type: InternalIP - address: 34.127.42.172 type: ExternalIP </code></pre> <p>So multiple address types are present in parallel (there's also usually hostname data set in there too). How...
coderanger
<p>I am re-designing a dotnet backend api using the CQRS approach. This question is about how to handle the Query side in the context of a Kubernetes deployment.</p> <p>I am thinking of using MongoDb as the Query Database. The app is dotnet webapi app. So what would be the best approach:</p> <ol> <li><p>Create a sid...
brando
<p>I would start with the most simple approach and that is to place the write and read side together because they belong to the same bounded context.</p> <p>Then in the future if it is needed, then I would consider adding more read side or scaling out to other regions.</p> <p>To get started I would also consider adding...
Tore Nestenius
<p>I have created a custom Identity Service that mainly uses Identity Server 4 with Azure AD as an external provider. I have configured azure ad, having all the required ids &amp; secrets and locally was able to authenticate any registered user in Azure.</p> <p>The problem appears when we deployed that service into Kub...
Solomiia Kalinchuk
<p>When you click on the sign-in button to authenticate with IdentityServer, do look at the URL to see what <strong>returnurl</strong> was actually sent to it and add it to the client definition.</p> <p>For example:</p> <pre><code>https://demo.identityserver.io/Account/Login?ReturnUrl=%2Fdiagnostics </code></pre>
Tore Nestenius
<p>we need to initiate Kubernetes cluster and start our development. Is it OK to have 1 master Control Plane node and 1 worker node with our containers to start the development? We can afford for services to be unavailable in case of upgrades, scaling and so on, I've just worried if I am lacking some more important inf...
vel
<p>Sure, you can also have single node clusters. Just as you said, that means if one node goes down, the cluster is unavailable.</p>
coderanger
<p>While scaling-in, HPA shouldn't terminate a pod that has a job running on it. This is taken care of by AWS autoscaling groups in the form of scale-in protection for instances. Is there something similar in kubernetes?</p>
VasKan
<p>You use terminationGracePeriodSeconds to make your worker process wait until it is done. It will get a SIGTERM, then has that many seconds to finish (default 9 but you can make it anything, some of my workers have it set to 12 hours), then SIGKILL if it hasn't exited. So stop accepting new work units on SIGTERM, set...
coderanger
<p>I have an application made of a few microservices. UI has is served via Nginx and accesses the API via reverse proxy. This is a local Kubernetes deployed with Rancher.</p> <p>UI service is NodePort so I can access it outside of the cluster and API can be either NodePort or ClusterIP. In API microservice there is an ...
eugeneK
<p>You need to use <code>externalTrafficPolicy: Local</code> and then look at the actual <code>REMOTE_ADDRESS</code> or whatever your web framework calls it.</p>
coderanger
<p>We plan to use AWS EKS to run a stateless application.</p> <p>There is a goal to achieve optimal budget by using spot instances and prefer them to on-demand ones.</p> <p>Per <a href="https://aws.github.io/aws-eks-best-practices/cluster-autoscaling/cluster-autoscaling/#spot-instances" rel="nofollow noreferrer">AWS re...
dusty
<p>This is not something the Kubernetes scheduler supports. Weights in affinities are more like score multiplies, and maxSkew is a very general cap on how out of balance things can get, but not the direction of that imbalance.</p> <p>You would have to write something custom AFAIK, or at least I've not seen anything for...
coderanger
<p>I'm planning to have an <em>initcontainer</em> that will handle some crypto stuff and then generate a source file to be sourced by a <em>container</em>. The source file will be dynamically generated, the VARS will be dynamic, this means I will never know the VAR names or it's contents. This also means I cannot use k...
JGG
<p>Change the <code>command</code> and/or <code>args</code> on the main container to be more like <code>bash -c 'source /tmp/sm/filetobesourced &amp;&amp; exec whatevertheoriginalcommandwas'</code>.</p>
coderanger
<p>When I run gdb on my binary inside kubernetes pod in container it starts loading symbol after that it suddenly gets terminated with SIGTERM and exit code 137. I checked for describe pod it shows reason Error. I have added ptrace capabilities in yaml. Can someone help me with this.</p>
Pranay Nagpure
<p>Exit code 137 means that the process was killed by signal 9 (137=128+9). Most likely reason is that container was running out of memory and gdb was killed by OOM Killer. Check <code>dmesg</code> output for any messages from OOM Killer.</p>
ks1322
<h3>Context</h3> <p>I am running an application (Apache Airflow) on EKS, that spins up new workers to fulfill new tasks. Every worker is required to spin up a new pod. I am afraid to run out of memory and/or CPU when there are several workers being spawned. My objective is to trigger auto-scaling.</p> <h3>What I have t...
alt-f4
<p>This is handled by a tool called cluster-autoscaler. You can find the EKS guide for it at <a href="https://docs.aws.amazon.com/eks/latest/userguide/cluster-autoscaler.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/cluster-autoscaler.html</a> or the project itself at <a href="https:/...
coderanger
<p><strong>The scenario</strong>: Selenium is a browser automation tool that can be run in a K8s cluster, it consists of Selenium-hub (master) and selenium-nodes (workers) where the hub receives test requests and creates nodes (pods) ondemand (dynamically) to run the test-case, after execution of a test-case the runner...
Bahram
<p>Technically: yes you can either configure or edit-the-code of your CNI plugin (or write one from scratch).</p> <p>In practice: I know of none that work quite that way. I know Calico does allow having multiple IP pools so you could have a small one just for Selenium pods but I think it still attempts to minimize reus...
coderanger
<p>I am unable to delete ‘test/deployment/sandbox-v2/tmp/dns’ after deleting the github repository 'test'. I am unable to reclone it in my CentOS system. Even after recloning in other folder,running site.yml file of sandbox fails at logs. So i'm trying to completely remove test repository and reclone it for fresh run. ...
medgai
<p>It's hard to say but if this was bind-mounted into a container and that container was running its process as root (uid 0) then files it created would be owned by uid 0 even outside the container. Gotta get your <code>sudo</code> on.</p>
coderanger
<p>I have k8s custer in digital ocean.</p> <p>I would like to expose some app to internet.</p> <p>Do I need for every app DO loadbalancer? It coast 10$/m it F* expensive when I would like to expose 5 aps.</p> <p>Is there any workaround without external DO loadbalancer?</p>
bamamey612
<p>Copying this from the last time someone asked this a few days ago (which has now been delete):</p> <p>You can use a node port service (annoying because you'll have to use random high ports instead of 80/443) or you can switch your ingress controller to listen on the host network directly (allows use of 80/443 but po...
coderanger
<p>I have the following to exec into a pod to run a command</p> <pre><code>fmt.Println("Running the command:", command) parameterCodec := runtime.NewParameterCodec(scheme) req.VersionedParams(&amp;corev1.PodExecOptions{ Command: strings.Fields(command), Stdin: stdin != nil, Stdout: true, Stder...
Mike
<p>got it</p> <pre><code>pod, err := clientset.CoreV1().Pods("default").Get(podname, metav1.GetOptions{}) if err != nil { return "", err } fmt.Println(pod.Spec.Containers[0]) </code></pre>
Mike
<p>I am managing my k8s cluster using terraform and has tiller version 0.10.4,</p> <p>Now I made some changes in my terraform file. so when I run <strong>terraform init</strong> I am getting following error.</p> <p><em>error initializing local helm home: Looks like &quot;https://kubernetes-charts.storage.googleapis.com...
Alpesh Jikadra
<p>The old Google based Chart storage system has been decommissioned. But also Helm 2 is no longer supported at all and Helm 3 does not use Tiller. You can find a static mirror of the old charts repo on Github if you go poking, but you need to upgrade to Helm 3 anyway so just do that instead.</p>
coderanger
<p>Is it alright to use Google Compute Engine virtual machines for MySQL DB?</p> <p>db-n1-standard-2 costs around $97 DB for single Clould SQL instance and replication makes it double.</p> <p>So I was wondering if its okay to use <code>n1-standard-2</code> which costs around $48 and the applications will be in Kubernet...
user630702
<p>This is entirely up to your needs. If you want to be on call for DB failover and replication management, it will definitely be cheaper to run it yourself. Zalando has a lot of Postgres-on-Kubernetes automation that is very good, but at the end of the day who do you want waking up at 2AM if something breaks. I will n...
coderanger
<p>Running Pods with WorkloadIdentity makes an Google Credential error when auto scaling started.</p> <p>My application is configured with WorkloadIdentity to use Google Pub/Sub and also set HorizontalPodAutoscaler to scale the pods up to 5 replicas.</p> <p>The problem arises when an auto scaler create replicas of the ...
Eric Lee
<p>There is no specific solution other than to ensure your application can cope with this. Kubernetes uses DaemonSets to launch per-node apps like the metadata intercept server but as the docs clearly tell you, that takes a few seconds (noticing the new node, scheduling the pod, pulling the image, starting the containe...
coderanger
<p>I've deployed Kubernetes cluster on my local machine.The default allocatable pods in Kubernetes are 110. I want to increase the number of pods per node in my cluster.Can anyone let me know if it's possible ? If yes, how can we do it?</p>
pikubhai
<p>Yes, you can control this with the <code>max-pods</code> option to the Kubelet, either via a command line flag or Kubelet config file option. But beware that we don't test as much outside the normal scaling targets so you might be able to break things.</p>
coderanger
<p>I am trying to mount S3 bucket using s3fs-fuse to the Kubernetes pod. My S3 bucket is protected by IAM roles and i dont have Access Keys and Secret Keys to access S3 bucket. I know how to access a S3bucket from the Kubernetes pod using Access &amp; Secrets Keys, but how do we access S3 bucket using IAM roles ?</p> <...
babs84
<p>You use the IRSA system, attaching an IAM role to a Kubernetes service account and then attaching that K8s SA to your pod. See <a href="https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-servic...
coderanger
<p>I have a kubectl installed on the my local system. I connect to K8S running on GCP. Where does my k8s master server run ? On my local machine or on GCP?</p>
Darshan Naik
<p>In GCP. If you mean GKE specifically, it is running on special magic internal GKE systems you can't see directly.</p>
coderanger
<p>I am guess I am just asking for confirmation really. As had some major issues in the past with our elastic search cluster on kubernetes.</p> <p>Is it fine to add a pod affinity to rule to a already running deployment. This is a live production elastic search cluster and I want to pin the elastic search pods to spec...
cjm888
<p>Any change to the pod template will cause the deployment to roll all pods. That includes a change to those fields. So it’s fine to change, but your cluster will be restarted. This should be fine as long as your replication settings are cromulent.</p>
coderanger
<p>I'm trying to run the command &quot;<strong>oc apply -f basic-ocp-demo.yaml</strong>&quot; in order to <strong>create services and deployment</strong> in my <strong>openshift</strong>, but I get an error regarding &quot;<strong>unable to decode &quot;basic-ocp-demo.yaml &quot;: no kind &quot;Deployment&quot; is regi...
Ciocoiu Petrisor
<p>It would appear you are running an extremely old version of OpenShift/Kubernetes. So all you have available is <code>apps/v1alpha1</code>. You should upgrade ASAP.</p>
coderanger
<p>When am building the image path, this is how I want to build the image Path, where the docker registry address, I want to fetch it from the configMap.</p> <p>I can't hard code the registry address in the values.yaml file because for each customer the registry address would be different and I don't want to ask custom...
rajiv chodisetti
<p>Check out the <code>lookup</code> function, <a href="https://helm.sh/docs/chart_template_guide/functions_and_pipelines/#using-the-lookup-function" rel="nofollow noreferrer">https://helm.sh/docs/chart_template_guide/functions_and_pipelines/#using-the-lookup-function</a></p> <p>Though this could get very complicated v...
coderanger
<p>I am trying to pull values out of a kubernetes helm chart values.yaml that has a number as one of the keys and I'm getting a <code>parse error unexpected ".1" in operand</code>. How can I access values that contain a number in its path? </p> <p>Let's say my values.yaml looks like this:</p> <pre><code>global: foo...
Coherent
<p>The easy option is to just quote it in your values file so it's a string but:</p> <pre><code>{{ index .Values.globals 1 "bar2"}} </code></pre> <p>is probably what you want.</p>
coderanger
<p>In my application with docker-compose I have 2 container, 1 nginx and 1 python script crontab that update some files in nginx/html folder. With docker-compose when I declare </p> <pre><code>volumes: - shared-volume:/usr/share/nginx/html/assets/xxx:ro </code></pre> <p>the initial files in the nginx images are ...
Davide
<p>This generally requires an initContainer which runs cp. it’s not a great solution but it gets the job done. </p>
coderanger
<p>The nodeSelectorTerms in a PersistentVolume help the volume identify which node to bind to. For example:</p> <pre><code>nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - mynodename </code></pre> <p...
T_W
<p>This is not supported. Apparently I need more words than just that.</p>
coderanger
<p><strong>Context</strong> :</p> <p>We have a Apache Nifi cluster deployed in Kubernetes as Stateful sets, and a volume claim template is used for Nifi repositories.</p> <p><a href="https://github.com/cetic/helm-nifi" rel="nofollow noreferrer">Nifi helm charts we are using</a></p> <p>There is a use case where file pro...
arunvg
<p>Put it in the pod template like normal. NFS is a &quot;ReadWriteMany&quot; volume type so you can create one PVC and then use it on every pod simultaneously. You can also configure NFS volumes directly in the pod data but using a PVC is probably better.</p> <p>It sounds like what you have is correct :)</p>
coderanger
<p>In my company, we have an internal Security Token Service consumed by all web apps to validate the STS token issued by the company central access management server (e.g BigIP/APM). Therefore the same endpoint for token validation REST API has to be repeatedly set as an environment variable in Deployment Configuratio...
Sam D.
<p>Nothing built in. You could built that yourself with some webhooks and custom code. Otherwise you need to add the <code>envFrom</code> pointing at a Secret and/or ConfigMap to each pod template and copy that Secret/ConfigMap to all namespaces that needed it (kubed can help with that part at least).</p>
coderanger
<p>I have an nginx pod in the default namespace and a ClusterIP service exposing the pod.</p> <pre><code>$ kubectl run nginx-pod --image=nginx $ kubectl expose po nginx-pod --name=nginx-service --port=8080 --target-port=80 --type=ClusterIP </code></pre> <p>I can access the service via its internal IP from inside the cl...
actual_panda
<p>The magic service hostnames (and pod hostnames) are provided by the &quot;cluster DNS&quot; service, usually CoreDNS these days. A resolv.conf aimed at the internal CoreDNS is automatically injected into all pods. But I'm guessing by &quot;outside of a pod&quot; you mean on the underlying host which has no such entr...
coderanger
<p>I have two use cases where teams only want Pod A to end up on a Node where Pod B is running. They often have many Copies of Pod B running on a Node, but they only want one copy of Pod A running on that same Node. </p> <p>Currently they are using daemonsets to manage Pod A, which is not effective because then Pod ...
Howard_Roark
<p>The current scheduler doesn’t really have anything like this. You would need to write something yourself.</p>
coderanger
<p>I have EKS cluster where my application code resides in pods (container). Client want this cluster to be hosted on their AWS cloud. How do I make sure that my code will be secure in client's environment. How do I make sure that he cannot copy or has no access to the code?</p>
Harsh Upparwal
<p>You can't. At most you can compile and obfuscate it with whatever tools your language provides. This is generally pointless though, decompilers are very very good these days.</p>
coderanger
<p>I have traefik installed via the helm chart.</p> <p>I have a domain: <strong>example.com</strong></p> <p>It has some blog posts.</p> <p>I now created a subdomain: <strong>subdomain.example.com</strong></p> <p>I have the list of my blogs urls:</p> <pre><code>/blog-1 /blog-2 </code></pre> <p>Both the base domain and t...
Henry
<p>Just one redirect per middleware, but you can have as many middleware as you want.</p> <p>But in this case you can use the regex:</p> <pre><code> redirectRegex: regex: &quot;https://example.com/(blog-1|blog-2|whatever)&quot; replacement: &quot;https://subdomain.example.com/$1&quot; </code></pre>
coderanger
<p>I want to know if the apiserver_request_duration_seconds accounts the time needed to transfer the request (and/or response) from the clients (e.g. kubelets) to the server (and vice-versa) or it is just the time needed to process the request internally (apiserver + etcd) and no communication time is accounted for ?</...
Karim Manaouil
<p>How long API requests are taking to run. Whole thing, from when it starts the HTTP handler to when it returns a response.</p>
coderanger
<p>I am fairly new to kubernetes and learning kubernetes deployments from scratch. For a microservice based projecct that I am working on, each microservice has to authenticate with their own client-id and client-secret to the auth server, before requesting any information (JWT). These ids and secrets are required for ...
Sakibur Rahman
<p>Depends on how automatic you want it to be. A simple approach would be an initContainer to provision a new token, put that in a shared volume file, and then an entrypoint script in the main container which reads the file and sets the env var.</p> <p>The problem with that is authenticating the initContainer is hard. ...
coderanger
<p>I'm running a k8 cluster on Docker for Mac. To allow a connection from my database client to my mysql pod, I use the following command <code>kubectl port-forward mysql-0 3306:3306</code>. It works great, however a few hours later I get the following error <code>E0201 18:21:51.012823 51415 portforward.go:233] lost ...
thatguyjono
<p>Port forwards are generally for short term debugging, not “hours”. What you probably want is a NodePort type service which you can then connect to directly.</p>
coderanger
<p>I am trying to configure kubernetes cluster but as per blog it's telling me to disable SELinux. Is there any specific reason for it?</p>
vivek saurabh
<p>In theory you could write all the needed policies for it to work. But the Selinux subsystem doesn’t really understand namespaces and this only barely understands containers. So if you’re already running a minimalist host OS it gets you very little added security for a great deal of complexity, most people skip it.</...
coderanger
<p>I have an application which makes use of RabbitMQ messages - it sends messages. Other applications can react on these messages but they need to know which messages are available on the system and what they semantically mean.</p> <p>My message queuing system is RabbitMQ and RabbitMQ as well as the applications are h...
JohnDoe
<p>RabbitMQ does not have this in any kind of generic fashion so you would have to write it yourself. Rabbit messages are just a series of bytes, there is no schema registry.</p>
coderanger
<p>For multi tenancy support, I would like to create like a datastore concept limiting the storage per tenant across all namespaces in the tenant. Kubernetes website <a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/#storage-resource-quota" rel="nofollow noreferrer">[1]</a> says "given namespace", but...
Harrish A
<p>Not directly. The quota system is per namespace only. But of course you can make a validating webhook yourself which implements whatever logic you want.</p>
coderanger
<p>What would be the behavior of a multi node kubernetes cluster if it only has a single master node and if the node goes down?</p>
user3079474
<p>The control plane would be unavailable. Existing pods would continue to run, however calls to the API wouldn't work, so you wouldn't be able to make any changes to the state of the system. Additionally self-repair systems like pods being restarted on failure would not happen since that functionality lives in the con...
coderanger
<p>I am trying to ensure that a pod is deleted before proceeding with another Kubernetes Operation. So the idea I have is to Call the Pod Delete Function and then call the Pod Get Function.</p> <pre><code>// Delete Pod err := kubeClient.CoreV1().Pods(tr.namespace).Delete(podName, &amp;metav1.DeleteOptions{}) if err !...
tr_quest
<p><code>err != nil &amp;&amp; errors.IsNotFound(err)</code></p> <p>Also this is silly and you shouldn't do it.</p>
coderanger
<p>My team is using the Python3 kubernetes package in some of our code. What are the exceptions that can be raised by a call to <code>kubernetes.config.load_kube_config</code>?</p>
DeepDeadpool
<p>On top of the standard errors that can be raised at any point (MemoryError, OSError, KeyboardInterrupt, etc), it mostly uses its own ConfigException class. Just go read the code for yourself <a href="https://github.com/kubernetes-client/python-base/blob/master/config/kube_config.py" rel="nofollow noreferrer">https:/...
coderanger
<p>I am attempting to use the k8s API inside the cluster to update a deployment within the namespace home.</p> <p>ClusterRole:</p> <pre><code>apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: namespace: home name: home-role rules: - apiGroups: [""] # "" indicates the core API group resources:...
Nicholas Martinez
<p>First off deployments are in apps/v1, not v1. Then you probably need to share the pod definition for the place you are running your api call from. You may have disabled service account token mounting.</p>
coderanger
<p>I am using kubernetes(v1.15.2) to manage my skywalking-ui(v6.5.0) apps,recently I found some app's not accessable but the pod is still running, I am not sure the app is works fine,there is no error output in pod's logs.But the pod status icon give tips: <code>the pod is in pending state</code>.</p> <p><a href="http...
Dolphin
<p>So you can see this more clearly in the output. The pod is Running but the Ready flag is false meaning the container is up but is failing the Readiness Probe.</p>
coderanger
<p>I'm looking a way to call /test endpoint of my service on all the pods I could have (essentially I have only 3 pods).</p> <p>It's is that possible?</p> <p>I tried a Cloud Function that calls my balanced ip (<a href="https://10.10.10.10:1111/test" rel="nofollow noreferrer">https://10.10.10.10:1111/test</a>) however...
Dr3ko
<p>There is no specific way, you'll have to use the Kubernetes API to get all the pod IPs and make a request to each individually. This is usually a sign of some wonky software design though.</p>
coderanger
<p>Let's say we have 2 Nodes in a cluster.</p> <p><code>Node A</code> has 1 replica of a pod, <code>Node B</code> has 2 replicas. According to <a href="https://youtu.be/y2bhV81MfKQ?list=WL&amp;t=1848" rel="nofollow noreferrer">this talk (YouTube video with a time tag)</a> from Google Cloud engineers, a request which w...
LEQADA
<p>I think you might be mixing up two subsystems, service proxies and CNI. CNI is first, it’s a plug-in based system that sets up the routing rules across all your nodes so that the network appears flat. A pod IP will work like normal from any node. Exactly how that happens varies by plugin, Calico uses BGP between the...
coderanger
<p>I was looking into an entirely separate issue and then came across this question which raised some concerns:</p> <p><a href="https://stackoverflow.com/a/50510753/3123109">https://stackoverflow.com/a/50510753/3123109</a></p> <p>I'm doing something pretty similar. I'm using the <a href="https://github.com/Azure/secret...
cjones
<p>The comment on the answer you linked was incorrect. I've left a note to explain the confusion. What you have is fine, if possibly over-built :) You're not actually gaining any security vs. just using Kubernetes Secrets directly but if you prefer the workflow around AKV then this looks fine. You might want to look at...
coderanger
<p>I want to refer a property of an object created by a CRD.</p> <p>Here is my example. I create a Cloud SQL instance using the CRD from <a href="https://github.com/GoogleCloudPlatform/k8s-config-connector" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/k8s-config-connector</a>.</p> <p>This generate...
Stefan Thorpe
<p>Nothing in particular, the way we do it is the controller exposes info like the IP or hostname on the Status sub-struct of the subordinate object, and then copy that into the Status of the root object, and then we read from that and inject it into a config file.</p> <p><a href="https://github.com/Ridecell/ridecell-...
coderanger
<p>I am trying to track and monitor, how much time does a pod take to come online/healthy/Running.</p> <p>I am using EKS. And I have got HPA and cluster-autoscaler installed on my cluster.</p> <p>Let's say I have a deployment with <code>HorizontalPodAutoscaler</code> scaling policy with 70% <code>targetAverageUtilizat...
kadamb
<p>There is nothing out of the box for this, you will need to build something yourself.</p>
coderanger
<p>I'm trying to build a basic frontend-backend topology in Kubernetes (Amazon EKS actually) with both frontend and backend pods residing on the same node. I want every node to have 2 interfaces: public one, that will connect to internet gateway, and private one, that won't. So it would seem natural to somehow map fron...
etherman
<p>This is not usually how things work in Kubernetes. Pod IPs would always be "private", i.e. cluster IPs that are not used with the internet. You poke specific holes into the cluster IP space using LoadBalancer-type Services. In AWS terms, all pods have private IPs and you use ELBs to bridge specific things to the pub...
coderanger
<p>I am exercising on K8S, and I need to share some data between my containers inside a POD, the problem I have is that I need to make containers have available some data from other containers that is already present on that containers at startup. Let me show an example of what I mean:</p> <p>Container A at startup: <c...
Luigi De Marco
<p>Make a emptyDir volume, mount it at <code>/newroot</code> on both A and B with both of those set as initContainers which will run <code>command: [bash, -c, &quot;cp /root/dir/a.txt /newroot/dir/a.txt]</code> and similar for B. On C mount that emptyDir using <code>subPath</code> on either <code>/root/dir</code> or th...
coderanger
<p>I am trying to get Redis failover to work in Kubernetes with a worker-node failure scenario. I have a K8s cluster that consists of a master node and two worker nodes. The master node does not schedule pods. The manifests for Redis are such that there is a master and a slave instance in a stateful set and 3 sentin...
Steven Onishi
<p>What you want is a PodDisruptionBudget. That will make voluntary evictions at least not break things. Beyond that you can use hard anti-affinities to force the pods to be scheduled on different nodes. Failures are still possible though, if you lose two nodes at the same time the Sentinels can desync. This is a large...
coderanger