prompt stringlengths 65 38.7k | response stringlengths 41 29.1k |
|---|---|
<ul>
<li>client-go v0.19.2</li>
<li>golang 1.13</li>
</ul>
<p>I'm building a tool to create k8s resources from json(just like kubectl create -f).</p>
<p>I found that dynamic client can do such things,but when i use it with code bellow,i found it is hard to find schema.GroupVersionResource for given resource's json.Am i... | <p>You can use <code>restmapper</code> that directly queries the definitions from <code>metav1</code> using the <code>discovery</code> client.</p>
<pre class="lang-golang prettyprint-override"><code>import (
"k8s.io/client-go/rest"
"k8s.io/client-go/discovery"
"k8s.io/client-go/rest... |
<p>In k8s you can <a href="https://yankeexe.medium.com/how-rolling-and-rollback-deployments-work-in-kubernetes-8db4c4dce599" rel="nofollow noreferrer">roll back a deployment</a>. Can you also roll back a service?</p>
<p>Rolling back a service may be helpful if there was an erroneous update done to a service resource.</... | <p>rollback / rollout undo is not available for <code>service</code> resource:</p>
<pre><code>kubectl rollout
Manage the rollout of a resource.
Valid resource types include:
* deployments
* daemonsets
* statefulsets
</code></pre>
|
<p>I'm new to Ingress in Kubernetes. I installed Ingress NGINX controller in my AKS cluster. My application runs in a pod (Port 80) in testns (Namespace). I created a service for it in the same namespace. Now I want to access my application from outside. So I created an Ingress yaml for it.</p>
<p><strong>service.yaml<... | <p>Try adding the ingress class into YAML config <code>kubernetes.io/ingress.class: "nginx"</code></p>
<p>as annotation</p>
<pre><code>kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/rewrite-target: /
</code></pre>
<p>Example</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingre... |
<p>I am new for pod health check with Readiness and Liveness. Recently I am working on Readiness. The scenario is as following:</p>
<p>The pod is a RestAPI service, it needs to connect to Database and store information in DB. So if RestAPI service wants to offer service, it needs to make sure database connection is suc... | <p><strong>readiness</strong> and <strong>liveness</strong> is mostly for service you are running inside container, there could be a scenario where your DB is up but there is issue with the <strong>application</strong> at that time also your <strong>readiness</strong> will be <strong>Up</strong> as DB is running, in id... |
<p>I already installed Linkerd on a Kubernetes cluster that is runing in AWS: <a href="https://linkerd.io/2.11/getting-started/" rel="nofollow noreferrer">Linkerd - Getting Started</a></p>
<p>All checks are ok, but I cannot see the viz dashboard in my local:</p>
<pre><code>kubectl -n linkerd-viz port-forward svc/web 80... | <p>You can expose the dashboard in a couple ways. You can modify the web service to add an external load balancer, which will respect any AWS annotations you already use with AWS load balancers. You can also create the appropriate routing rules for your existing ingress. You can find some examples here: <a href="https:... |
<p>I have a k0s Kubernetes cluster on a single node. I am trying to run a <code>selenium/standalone-chrome</code> to create a remote Selenium node. The trouble that I am having is that it responds if I port forward <code>4444</code> from the pod, but cannot seem to access it via a Service port. I get connection refuse... | <p>Service's syntax with:</p>
<pre><code> selector:
app: standalone-chrome
</code></pre>
<p>is correct, <code>selector</code> should be matched by <code>label</code>.</p>
<blockquote>
<p>Services match a set of Pods using labels and selectors, a grouping
primitive that allows logical operation on objects in Kubern... |
<p>How do I expose an ingress when running kubernetes with minikube in windows 10?</p>
<p>I have enabled the minikube ingress add on.</p>
<p>My ingress is running here...</p>
<pre><code>NAME CLASS HOSTS ADDRESS PORTS AGE
helmtest-ingress nginx helmtest.info 192.168.49.2 80 ... | <p>OP didn't provide further information so I will provide answer based on the current information.</p>
<p>You can run <code>Ingress</code> on <a href="https://minikube.sigs.k8s.io/docs/" rel="nofollow noreferrer">Minikube</a> using the <code>$ minikube addons enable ingress</code> command. However, ingress has more ad... |
<p>I have an nginx-ingress calling a custom <code>auth-service</code> before sending requests to the backend service, using this simple ConfigMap and Ingress:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
...
data:
global-auth-url: auth-service-url:8080/authenticate
global-auth-method: GET
---
apiVersio... | <p>One way you can achieve this behavior is by abusing the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#canary" rel="noreferrer">canary feature</a>.</p>
<p>For your <code>backend-service</code>, create a normal Ingress, e. g.</p>
<pre class="lang-yaml prettyprint-overr... |
<p>I have a go routine running in docker container. I need output of the command dmidecode. But its coming blank.</p>
<p>Go:</p>
<p>func main() {</p>
<pre><code> cmd := exec.Command("dmidecode","-t 1")
x,_ := cmd.Output()
fmt.Println("output =======", string(x))
</code></pre>
<p... | <blockquote>
<p>What am I missing here?</p>
</blockquote>
<p>For starters ,error handling.</p>
<pre><code> x,_ := cmd.Output()
</code></pre>
<p>Never, ever ignore an error in Go. Unlike languages like, say, Pyhton, there is no exception raising - handling error return values is your <em>only</em> chance to figure o... |
<p>To use alert by E-mail in Grafana, we have to set SMTP settings in grafana.ini.</p>
<p>On Ubuntu, we can easily run the grafana-prometheus-k8s stack by command
<code>microk8s enable prometheus</code>
However, how can we feed grafana.ini to grafana running in a k8s pod?</p>
| <p>We can modify grafana k8s deployment manifest by <strong>volumeMounts</strong> to feed grafana.ini on our host to grafana running in a pod.</p>
<p>First, prepare your grafana.ini with SMTP settings. E.g.</p>
<pre><code>[smtp]
enabled = true
host = smtp.gmail.com:465
# Please change user and password to your ones.
us... |
<p>I have a small web application (a Rails app called <code>sofia</code>) that I'm deploying locally with <code>minikube</code>.</p>
<p>When I create the k8s resources and run my deployment, the containers do not contain any of the files that were supposed to be copied over during the image build process.</p>
<p>Here's... | <p>The issue is that Volumes are not behaving the same way in Docker in docker-compose and K8s. Kompose can't perfectly translate volume.
In Docker with docker-compose, your declared volume keep the existing files from the directory, while in k8s, a volume is created empty and shadow the existing content.</p>
<p>There ... |
<p>I am running MongoDB as a StatefulSet in Kubernetes.</p>
<p>I am trying to use startup/liveness probes, and I noticed some helm charts use the MongoDB "ping" command.</p>
<p>As <a href="https://docs.mongodb.com/manual/reference/command/ping/" rel="nofollow noreferrer">the documentation</a> says,</p>
<block... | <p>I am not sure if the ping is a good idea. You don't care about the general state of the server; you care that it can receive connections.</p>
<p>Liveness probes have a timeout, so it's possible that in the future, when you're starting a new replica, the new pod in the stateful set will fail while waiting for the rep... |
<p>I'm confused about why we use configMap versions. I'm seeing multiple versions of confimap in my k8s cluster that is attached to a deployment/sts. I was expecting if I apply some changes in my yaml it will get reflected in all of the configMap versions, but that is not happening. Can someone help with this.</p>
<p>I... | <p>Kubernetes provides a way to store rollout information for some resources by default, one of those is deployments.</p>
<p>You can perform some commands providing a <code>--record</code> flag, which will record the current and new state of the deployment, allowing you to perform a <code>rollback</code></p>
<p>See <a ... |
<p>In this application, nodejs pods are running inside kubernetes, and mongodb itself sitting outside at host as localhost.</p>
<p>This indeed not good design, but its only for dev environment. In production a separte mongodb server will be there, as such option to have a non loopback ip in endpoint, so will not be a p... | <p>I'm running on docker for windows, and for me just using <code>host.docker.internal</code> instead of <code>localhost</code> seems to work fine.</p>
<p>For example, my mongodb connection string looks like this:</p>
<pre><code>mongodb://host.docker.internal:27017/mydb
</code></pre>
<p>As an aside, my <code>hosts</cod... |
<p>I'm converting volume gp2 to volume gp3 for EKS but getting this error.<br />
<em><strong>Failed to provision volume with StorageClass "gp3": invalid AWS VolumeType "gp3"</strong></em><br />
This is my config.</p>
<p>StorageClass</p>
<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
met... | <p>I found the solution to use volume <code>gp3</code> in storage class on EKS.</p>
<ol>
<li>First, you need to install <code>Amazon EBS CSI driver</code> with offical instruction <a href="https://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html" rel="nofollow noreferrer">here</a>.</li>
<li>The next, you need to c... |
<p>While running a spark job with a Kubernetes cluster, we get the following error:</p>
<pre><code>2018-11-30 14:00:47 INFO DAGScheduler:54 - Resubmitted ShuffleMapTask(1, 58), so marking it as still running.
2018-11-30 14:00:47 WARN TaskSetManager:66 - Lost task 310.0 in stage 1.0 (TID 311, 10.233.71.29, executor 3... | <p>Had the same problem but I was able to upgrade to Spark 3.x where you can provide a <a href="http://spark.apache.org/docs/3.0.0/running-on-kubernetes.html#pod-template" rel="nofollow noreferrer">Pod Template</a>.</p>
<pre><code>--conf spark.kubernetes.executor.podTemplateFile=my_pod_template.yml
</code></pre>
<p>in ... |
<p>I have a spring-boot postgres setup that I am trying to containerize and deploy in minikube. My pods and services show that they are up.</p>
<pre><code>$ kubectl get pods
NAME READY STATUS RESTARTS AGE
server-deployment-5bc57dcd4f-zrwzs 1/1 Running 0 ... | <p>My proposition is to check that provided Deployment and Service have the same labels and selectors, because now in the Deployment config pod label is <code>app: server-deployment</code>, but in the Service config selector is <code>name: server-deployment</code>.</p>
<p>If we want to use <code>name: server-deployment... |
<p>I am trying to run a go-ethereum node on AWS EKS, for that i have used statefulsets with below configuration.
<a href="https://i.stack.imgur.com/RxyOt.png" rel="nofollow noreferrer">statefulset.yaml file</a></p>
<p>Running<code>kubectl apply -f statefulset.yaml</code> creates 2 pods out of which 1 is running and 1 i... | <p>You need to dynamically provision the access point for each of your stateful pod. First create an EFS storage class that support dynamic provision:</p>
<pre><code>kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: efs-dyn-sc
provisioner: efs.csi.aws.com
reclaimPolicy: Retain
parameters:
provisionin... |
<p>I have my python program running on k8s pod. The program reads data in pandas dataframe from the db & do some data transformation operations. In one of the operation, data size grows exponentially causing pod out of memory error. Since it's pandas, all data is held in the memory.</p>
<p>To avoid this, I am requi... | <p>In container, you need to get cgroup's memory.</p>
<pre><code> ls /sys/fs/cgroup/memory/
</code></pre>
<p>In container: <code>cat /sys/fs/cgroup/memory/memory.usage_in_bytes</code> to get memory usage.</p>
<p>Or in host: <code>/sys/fs/cgroup/memory/docker/[containerId]/memory.usage_in_bytes</code></p>
<p><a href="ht... |
<p>I have a Django application deployed on a K8s cluster. I need to send some emails (some are scheduled, others should be sent asynchronously), and the idea was to delegate those emails to Celery.</p>
<p>So I set up a Redis server (with Sentinel) on the cluster, and deployed an instance for a Celery worker and another... | <p><strong>Solution from @sofia that helped to fix this issue:</strong></p>
<p>You need to use the same namespace for the Redis server and for the Django application. In this particular case, change the namespace "redis" to "development" where the application is deployed.</p>
|
<p>I am following <a href="https://medium.com/@maheshd7878/restore-backup-migrate-kubernetes-cluster-with-velero-434fa151f1e8" rel="nofollow noreferrer">this tutorial</a> to install Velero to backup my cluster.</p>
<p>I have successfully installed the Minio the deployment but I am encountering a problem when installing... | <p>In the article you mentioned you fetch and install <code>minio 1.1.0</code> version.</p>
<pre><code>curl -LO https://github.com/heptio/velero/releases/download/v1.1.0/velero-v1.1.0-linux-amd64.tar.gz
tar -C /usr/local/bin -xzvf velero-v1.1.0-linux-amd64.tar.gz
export PATH=$PATH:/usr/local/bin/velero-v1.1.0-linux-amd... |
<p>I have <a href="https://github.com/kubernetes-client/csharp/" rel="nofollow noreferrer">KubernetesClient</a> code running my app on K3s Orchestrator.</p>
<p>I want to understand the difference(use-case) between two K3s APIs <code>PatchNamespacedServiceWithHttpMessagesAsync</code> and <code>ReplaceNamespacedServiceWi... | <p><strong>TL;DR</strong></p>
<p><strong><code>ReplaceNamespacedServiceWithHttpMessagesAsync</code> use <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT" rel="nofollow noreferrer">PUT</a> HTTP method. <code>PatchNamespacedServiceWithHttpMessagesAsync</code> use <a href="https://developer.mozilla.o... |
<p>I have a deployment YAML file and I have 4 different containers in a single pod.
I want to do this when one of the containers is crashes then I want to restart the pod.</p>
<p>Right now when the container is crashed, only that container restart but I want to restart all containers</p>
| <p>A Deployment can't do this but you could abuse a <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#job-v1-batch" rel="nofollow noreferrer">Job</a> with a <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy" rel="nofollow noreferrer">restartPolicy</a> ... |
<p>I have a server to server calls and I use GRPC (with .net core 5) It's working and test in local.</p>
<p>After that, I have moved all the services to Kubernetes Pod (Docker Desktop) and also tested through the flow (with swagger post-call) and it's working there too.</p>
<p>Now for monitoring, I added ISTIO and adde... | <p>I found a solution at <a href="https://istiobyexample.dev/grpc/" rel="nofollow noreferrer">https://istiobyexample.dev/grpc/</a> where it describes the missing item.</p>
<p>istio recommends using the name and version tag as Label but more importantly when working with GRPC, the service that exposes the GRPC needs to ... |
<p>I am looking at how to make OpenVPN client work on a pod's container, I explain what I do, but you can skip all my explanation and offer your solution directly, I don't care replacing all the below with your steps if it works, I want to make my container to use a VPN (ExpressVPN for example) in a way that both exter... | <p>Here is a minimal example of a pod with OpenVPN client. I used <a href="https://github.com/kylemanna/docker-openvpn" rel="noreferrer">kylemanna/openvpn</a> as a server and to generate a basic client config. I only added two routes to the generated config to make it working. See below:</p>
<pre class="lang-yaml prett... |
<p>I want to get a list of the names of all namespaces in a Kubernetes cluster using a kubectl command.</p>
<p>Currently, I am running the below kubectl command which gives me a list of all namespaces.</p>
<p>However, I don't want to see the 'ACTIVE' and 'AGE' columns. I just want the NAME column.</p>
<p>The reason beh... | <p><strong>Solution-1:</strong></p>
<p>Here is an alternate way:</p>
<pre><code> kubectl get ns --no-headers -o custom-columns=":metadata.name"
</code></pre>
<blockquote>
<p>-o=custom-columns= Print a table using a comma separated list of custom columns</p>
</blockquote>
<p><strong>Solution-2:</strong></p>
... |
<p>After deploying a simple API, mongodb is started even without any configuration in the API.</p>
<p><strong>Log error in pod:</strong></p>
<pre><code>2021-11-23 14:45:46 INFO [,,] Located property source: [BootstrapPropertySource {name='bootstrapProperties-configmap.api-products.default'}]
2021-11-23 14:45:47 INFO ... | <p>After some testing I found that the problem was the name of the environment variables in the Spring application's yaml file. The most strange was the error about "MongoDB" where i not used it!!!!!!</p>
<p><strong>The solution</strong> was change de variables names.</p>
<p><strong>Be careful the name variab... |
<p>I have a deployment YAML file and I have 4 different containers in a single pod.
I want to do this when one of the containers is crashes then I want to restart the pod.</p>
<p>Right now when the container is crashed, only that container restart but I want to restart all containers</p>
| <p>you can use preStop hook on each container to send a message to other ones to shutdown which will restart those containers. it is not the same as restarting pod, but might help with your use case</p>
|
<p>For some reason, my Pod in k8s could possibly labeled with <code>syscode</code> or <code>cib_syscode</code>, how can I relabel both of them to <code>cib_syscode</code>? That is to say if pod labeled with one of them, choose its label value as the result.
I have tried as follow, but it doesn't work because the target... | <p>Try the following:</p>
<pre class="lang-yaml prettyprint-override"><code> - job_name: ncr
honor_labels: true
scrape_interval: 30s
scrape_timeout: 30s
metrics_path: /metrics
scheme: http
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__me... |
<p>I have a powershell script, that take my variable and deliver it to the my helm upgrade command</p>
<pre><code>param
(
[Parameter(Mandatory = $false)]
$HELM_SET
)
helm upgrade --install myrelease -n dev my_service.tgz $HELM_SET
</code></pre>
<p>My HELM_SET var contains:<br />
<code>--set config.vali=... |
<p><strong>If you're passing <code>$HELM_SET</code> as a <em>single string</em> encoding <em>multiple arguments</em>, you cannot pass it as-is to a command</strong>.</p>
<p>Instead, you'll need to parse this string into an <em>array</em> of <em>individual</em> arguments.</p>
<p>In the <strong><em>simplest</em> case</s... |
<p>I'm trying to get the nginx ingress controller load balancer ip in Azure AKS. I figured I would use the kubernetes provider via:</p>
<pre><code>data "kubernetes_service" "nginx_service" {
metadata {
name = "${local.ingress_name}-ingress-nginx-controller"
namespace = loca... | <p>although i strongly advise against creating resources inside Kubernetes with Terraform, you can do that:</p>
<p>Create a Public IP with Terraform -> Create the ingress-nginx inside Kubernetes with Terraform and pass <code>annotations</code> and <code>loadBalancerIP</code>with data from your Terraform resources. T... |
<p>I am trying to write the nginx ingress config for my k8s cluster.</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: blabla-data-api-ingress
annotations:
nginx.ingress.kubernetes.io/proxy-connect-timeout: "360"
nginx.ingress.kubernetes.io/proxy-send-timeout: &quo... | <p>OP has confirmed, that the issue was solved in <a href="https://github.com/kubernetes/ingress-nginx/issues/7837" rel="nofollow noreferrer">this github topic</a></p>
<blockquote>
<p>it was exactly the issue you mentioned, thanks for your help</p>
</blockquote>
<p>This problem is related to <a href="https://nvd.nist.g... |
<p>I am encountering a weird behavior when I try to attach <code>podAffinity</code> to the <strong>Scheduler deployment from the official Airflow helm chart</strong>, like:</p>
<pre><code> affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions... | <p>I've recreated this scenario on my GKE cluster and I've decided to provide a Community Wiki answer to show that the <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity" rel="nofollow noreferrer">podAffinity</a> on the <a href="https://github.com/apac... |
<p>As <a href="https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer" rel="nofollow noreferrer">the kubernetes.io docs state about a <code>Service</code> of type <code>LoadBalancer</code></a>:</p>
<blockquote>
<p>On cloud providers which support external load balancers, setting the
type field to... | <p><strong>TLDR;</strong></p>
<p><a href="https://github.com/kubernetes/kubernetes/pull/105776" rel="nofollow noreferrer">Prior to Kubernetes <code>v1.23</code></a> it's not possible using <code>kubectl wait</code>, but using <code>until</code> together with <code>grep</code> like this:</p>
<pre><code>until kubectl get... |
<p>I have applied kiali in Istio 1.10.2 by using <a href="https://raw.githubusercontent.com/istio/istio/1.10.2/samples/addons/kiali.yaml" rel="nofollow noreferrer">this</a>. Now I am trying to secure it by filtering source ip address. I tried using authorization policy but it didn't work. It keeps allowing everyone whe... | <p>I manage to setup working <code>ALLOW</code> policy in the Istio 1.10.2 on <a href="https://cloud.google.com/compute" rel="nofollow noreferrer">GCP VMs</a>, the cluster is setup using kubeadm with Calico CNI plugin. I used this documentation - <a href="https://istio.io/latest/docs/tasks/security/authorization/authz-... |
<p>The <a href="https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions" rel="nofollow noreferrer">Kubernetes docs</a> state the following about the <code>metadata.resourceVersion</code> of a K8s object</p>
<blockquote>
<p>You must not assume resource versions are numeric or collatable. API clien... | <p>Posting this as a community wiki, feel free to edit and expand.</p>
<hr />
<p><strong>resourceVersion</strong></p>
<p>I think most correct answer will be:</p>
<blockquote>
<p>Kubernetes leverages the concept of resource versions to achieve
optimistic concurrency. All Kubernetes resources have a
"resourceVersion... |
<p>Revisiting the data locality for Spark on Kubernetes question: if the Spark pods are colocated on the same nodes as the HDFS data node pods then does data locality work ?</p>
<p>The Q&A session here: <a href="https://www.youtube.com/watch?v=5-4X3HylQQo" rel="nofollow noreferrer">https://www.youtube.com/watch?v=5... | <p>Locality is an issue Spark on Kubernetes. Basic Data locality does work if the Kubernetes provider provides a network topology plugins that are required to resolve where the data is and where the spark nodes should be run. <em>and you have built kubernetes to include the <a href="https://github.com/apache-spark-on-... |
<p><strong><em>Update</em></strong>
The issue is resolved. </p>
<ol>
<li>I shutdown docker desktop.</li>
<li>Deleted C:\ProgramData\DockerDesktop and .kube folder</li>
<li>Restarted docker desktop</li>
<li>reset docker desktop to factory defaults</li>
<li>and restarted it again and it worked.</li>
</ol>
<p>I have sta... | <h2>Just follow these steps</h2>
<ol>
<li>stop docker for desktop</li>
<li>remove the folder <code>~/Library/Group\ Containers/group.com.docker/pki</code></li>
</ol>
<pre><code> rm -rf ~/Library/Group\ Containers/group.com.docker/pki
</code></pre>
<ol start="3">
<li>start docker for destkop</li>
</ol>
<p>Found <a hre... |
<p>I'm looking for a way to quickly run/restart a Job/Pod from the command line and override the command to be executed in the created container.</p>
<p>For context, I have a Kubernetes Job that gets executed as a part of our deploy process. Sometimes that Job crashes and I need to run certain commands <em>inside the c... | <p>The commands you suggested don't exist. Take a look at <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands" rel="noreferrer">this reference</a> where you can find all available commands.</p>
<p>Based on <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="norefer... |
<p>I am using Istio 1.10.0 with minikube. Kubernetes server version is 1.19.8.</p>
<p>How to add multiple headers in http request? Is it possible to place dynamic values like <code>request.headers["Host"]</code>?</p>
<pre><code>X-Forwarded-Host $host;
X-Forwarded-Port 9090;
X-Forwarded-Proto http;
</code>... | <p>You add headers to requests the same way you did with response.</p>
<pre class="lang-yaml prettyprint-override"><code>...
headers:
request:
add:
foo: bar
...
</code></pre>
<p>If you want to add multiple headers added you can try</p>
<pre class="lang-yaml prettyprint-override"><code>...
headers:
request... |
<p>My application is running within a pod container in a kubernetes cluster. Every time it is started in the container it allocates a random port. I would like to access my application from outside (from another pod or node for example) but since it allocates a random port I cannot create a serivce (NodePort or LoadBal... | <p>Not supported, checkout the issue <a href="https://github.com/kubernetes/enhancements/pull/2611" rel="nofollow noreferrer">here</a>. Even with docker, if your range is overly broad, you can hit <a href="https://github.com/moby/moby/issues/11185" rel="nofollow noreferrer">issue</a> as well.</p>
|
<p>I'd like to retrieve all of the ingresses that act on a Kubernetes service.</p>
<p>I can get the ingresses in a namespace with the command <code>kubectl get ingress -n <namespace></code>.</p>
<p>Is there a command in kubectl that lets me fetch the ingresses that act on a specific Kubernetes service?</p>
| <p>To get all ingress rules in the cluster, you can run:</p>
<pre><code>kubectl get ingress -A
</code></pre>
<p>To get a summary of all ingress rules (including their used services), you can run this:</p>
<pre><code>kubectl describe ingress -A
</code></pre>
<p>To get the full ingress objects but in json format, you can... |
<p>I'm trying to deploy an Application Load Balancer to AWS using Terraform's <code>kubernetes_ingress</code> resource:</p>
<p>I'm using <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.3/" rel="nofollow noreferrer">aws-load-balancer-controller</a> which I've installed using <code>helm_release... | <p>Answering my own question, like most of the times :)</p>
<p>This is the proper setup, just in case someone come across it:</p>
<p>The <code>service</code>'s type has to be <code>NodePort</code>:</p>
<pre><code>resource "kubernetes_service" "questo-server-service" {
metadata {
name = &q... |
<p>I have a scenario like below,
Have two releases - Release-A and Release-B.</p>
<p>Currently, I am on Release-A and need an upgrade of all the microservices to Release-B.
I tried performing the helm upgrade of microservice - "mymicroservice" with the below command to deliver Release-B.</p>
<pre><code>helm -... | <p>Maybe this can help u out:</p>
<ul>
<li>Always use the helm <strong>upgrade --install</strong> command. I've seen you're using so you're doing well. This installs the charts if they're not present and upgrades them if they're present.</li>
<li>Use --atomic flag to rollback changes in the event of a failed operation ... |
<p>I'm trying to deploy an Application Load Balancer to AWS using Terraform's <code>kubernetes_ingress</code> resource:</p>
<p>I'm using <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.3/" rel="nofollow noreferrer">aws-load-balancer-controller</a> which I've installed using <code>helm_release... | <p>Try using the <code>alb.ingress.kubernetes.io/scheme: internet-facing</code> annotation.</p>
<p>You find a list of all available annotations here: <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.2/guide/ingress/annotations/" rel="nofollow noreferrer">https://kubernetes-sigs.github.io/aws-l... |
<p>command below gives an error: <code>error: flag key is required</code></p>
<pre><code>kubectl create secret tls k8-secret2 \
-n ingress-tls-test1 \
--cert ingress-tls-test1.pfx
</code></pre>
<p>I am able to create the secret using .crt and .key file:</p>
<pre><code>kubectl create secret tls aks-ingress-tls \... | <p>I needed to create a kube tls secret from .pfx file today
Credits to: <a href="https://adolfi.dev/blog/tls-kubernetes/" rel="noreferrer">https://adolfi.dev/blog/tls-kubernetes/</a></p>
<pre class="lang-bash prettyprint-override"><code>## you will enter the pfx PW on on the CMD/terminal
openssl pkcs12 -in pfx-filenam... |
<p>I am in the learning phase of Kubernetes and want to set up the CI/Cd pipeline for my project. I am using google cloud and have the following elements are ready</p>
<ol>
<li>3 Node cluster is deployed on google cloud</li>
<li>Github has been integrated with google cloud build to trigger the build.</li>
<li>I am usin... | <blockquote>
<p>How can I use helm to upgrade the latest charts.</p>
</blockquote>
<p>There is already default helm exist : <strong>gcr.io/$PROJECT_ID/cloud-builders-helm</strong></p>
<pre><code>- name: 'gcr.io/$PROJECT_ID/cloud-builders-helm'
args: ['upgrade', '--install', 'filebeat', '--namespace', 'filebeat', 'sta... |
<p>I'm working with prometheus to scrape k8s service metrics.</p>
<p>I created a service monitor for my service as below :</p>
<pre><code>apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: scmpoll-service-monitor-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: scmpo... | <p>It's not recommended to use Prometheus for such long <code>scrape_interval</code>. 2 minutes is suggested by many. Read this for details- <a href="https://prometheus.io/docs/prometheus/latest/querying/basics/#staleness" rel="nofollow noreferrer">Staleness</a>.</p>
<p>If you want to scrape data with interval exceedin... |
<h2><strong>Edited with new data after complete Kubernetes wipe-out.</strong></h2>
<p>Lately I am trying to do a test deploy of a Blazor server app on locally hosted Kubernetes instance running on docker desktop.</p>
<p>I managed to correctly spin up the app in a container, migrations were applied etc, logs are telling... | <h2><strong>AFTER COMPLETE RESET OF KUBERNETES THIS SOLUTION DOES NOT WORK!</strong></h2>
<p><strong>Will re-edit main question<br />
Leaving post for future use</strong></p>
<p>I solved the problem, or at least I think so.<br />
In addition to <a href="https://stackoverflow.com/questions/70115934/problem-with-deployin... |
<p>I'm trying to deploy <code>mongo</code> in <code>Kubernetes</code>, but before I run the <code>mongo</code> itself, it should do some prerequisites in init containers.</p>
<p>This is the list of <code>configMaps</code></p>
<pre><code>mongo-auth-env 4 16m
mongo-config 1 16m
mongo-config-env ... | <p>To clarify I am posting Community Wiki answer.</p>
<p>The problem here was small mistake - incorrect path (<code>/scripts/mongo-run.sh</code>) - the correct one: <code>/mongodb/scripts/mongo-run.sh</code></p>
<blockquote>
<p>@dejanmarich: correct path s /mongodb/scripts/mongo-run.sh, i just missed that, fixed now</p... |
<p>As of now i do</p>
<pre><code> kubectl --context <cluster context> get pod -A
</code></pre>
<p>to get pod in specific cluster</p>
<p>is there a python way to set kubernetes context for a virtual env , so we can use multiple context at the same time
example :</p>
<pre><code>Terminal 1:
(cluster context1) use... | <p>This isn't probably a rational solution, but anyway... At some time I used different <code>kubectl</code> versions for different clusters and I came up with a venv-like solution to switch between them. I wrote text files like this:</p>
<pre class="lang-sh prettyprint-override"><code>export KUBECONFIG="/path/to/... |
<p>I'm working with prometheus to scrape k8s service metrics.</p>
<p>I created a service monitor for my service as below :</p>
<pre><code>apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: scmpoll-service-monitor-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: scmpo... | <p>As mentioned, in general it's not advisable to use scrape intervals of more than 2 minutes in Prometheus (e.g. see <a href="https://stackoverflow.com/a/40233721/4747193">here</a>). This is due to the default <a href="https://prometheus.io/docs/prometheus/latest/querying/basics/#staleness" rel="nofollow noreferrer">s... |
<p>The k8s scheduling implementation comes in two forms: <a href="https://v1-18.docs.kubernetes.io/docs/reference/scheduling/" rel="nofollow noreferrer">Scheduling Policies and Scheduling Profiles</a>.</p>
<p><strong>What is the relationship between the two?</strong> They seem to overlap but have some differences. For ... | <p>The difference is simple: Kubernetes does't support 'Scheduling policies' from v1.19 or later. Kubernetes v1.19 supports <a href="https://kubernetes.io/docs/reference/scheduling/config/#multiple-profiles" rel="nofollow noreferrer">configuring multiple scheduling policies</a> with a single scheduler. We are using thi... |
<p>I’m trying to set up a nginx ingress controller to help validate a configuration. I’m trying to remove all the pieces and re-add the ingress controller to make sure everything I’ve documented works. The Ingress is removed, the service is removed, and pods successfully delete but they come back. The logs complain ... | <p>Easiest way to cleanup a namespace is to supply <code>-n namespace</code> with <code>all --all</code></p>
<pre><code>kubectl delete all --all -n ingress-nginx
</code></pre>
|
<p>We are running our kafka stream application on Azure kubernetes written in java. We are new to kubernetes. To debug an issue we want to take thread dump of the running pod.</p>
<p>Below are the steps we are following to take the dump.</p>
<ol>
<li><p>Building our application with below docker file.</p>
<pre><code>FR... | <p>Since you likely need the thread dump locally, you can bypass creating the file in the pod and just stream it directly to a file on your local computer:</p>
<pre><code>kubectl exec -i POD_NAME -- jstack 1 > threadDump.tdump
</code></pre>
<p>If your thread dumps are large you may want to consider piping to <code>p... |
<p>Trying to make the app in kubernetes with walkthrough of
Docker and Kubernetes - Full Course for Beginners
<a href="https://www.youtube.com/watch?v=Wf2eSG3owoA&t=14992s&ab_channel=freeCodeCamp.org" rel="nofollow noreferrer">https://www.youtube.com/watch?v=Wf2eSG3owoA&t=14992s&ab_channel=freeCodeCamp.... | <p>This warning message is not related to k8s. This is related to change in js driver for mongodb server discovery. In your code where you instantiate mongodb client you should specify the flag suggested in the warning message:</p>
<p><code>const driver = MongoClient(<connection string>, { useUnifiedTopology: tru... |
<p>I am trying to migrate the PostgreSQL database from a performance NAS service to a cheaper General NAS service. Now I want to created a new PV and PVC and make my kubernetes statefulset to binding to the new PVC. I tried to edit the PVC binding in statefulset but give me this error:</p>
<pre><code>The StatefulSet &q... | <p>Most fields become immutable once deployed, you can only delete and re-deploy for immutable fields. But this is not necessary a bad thing for your case. You can leverage the fact that when you delete StatefulSet, the PVC/PC are not automatically deleted. So you can consider create new StatefulSet which back by new P... |
<p>Today I want to change the PostgreSQL statefulset PVC name, to my surprise, I did not found any clain about the PVC in the kubernetes deployment define, this is the kubernetes deployment define of PostgreSQL:</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
name: reddwarf-postgresql-postgresql
name... | <p>pvc thats gets created as a part of statefulset will have a name which is an amalgamation of 3 components joined by <code>-</code> :</p>
<ol>
<li>Name defined in the <code>volumeClaimTemplates</code> section <code>data</code></li>
<li>Name of the <code>statefulset</code> in the metadata section which is <code>reddwa... |
<p>I'm trying to deploy a knative service in my local Kubernetes cluster (Docker Desktop for windows).
I could create a knative service when I use images from the google cloud container registry (gcr.io/knative-samples/helloworld-go) but I'm facing an issue when I use images from the docker hub. Please note that I not ... | <p>Finally, I resolved the issue by removing the ports session in the YAML file. If the container port is included, the application gets started in a container (I have verified the logs) but it never receives the traffic and fails with the ProgressDeadlineExceeded error.</p>
|
<p>I've tried everything on stack overflow and beyond and can't find a solution that works to redirect http to https. My current config is below.</p>
<p>My ingress is:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.class: "nginx"... | <p>For GKE (<code>1.17.13-gke.2600+</code>), find <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#https_redirect" rel="nofollow noreferrer">this document</a> explaining how to configure FrontendConfig with http-to-https redirect. Then you <a href="https://cloud.google.com/kubernetes-eng... |
<p>I have a Kubernetes Cluster with pods autoscalables using Autopilot. Suddenly they stop to autoscale, I'm new at Kubernetes and I don't know exactly what to do or what is supposed to put in the console to show for help.</p>
<p>The pods automatically are Unschedulable and inside the cluster put his state at Pending i... | <p>Pods failed to schedule on any node because none of the nodes have cpu available.</p>
<p>Cluster autoscaler tried to scale up but it backoff after failed scale-up attempt which indicates possible issues with scaling up managed instance groups which are part of the node pool.</p>
<p>Cluster autoscaler tried to scale ... |
<p>I know there have been already a lot of questions about this, and I read already most of them, but my problem does not seem to fit them.</p>
<p>I am running a postgresql from bitnami using a helm chart as described below. A clean setup is no problem and everything starts fine. But after some time, until now I could ... | <p>I really hope nobody else runs across this, but finally I found the problem and for once it was not only between the chair and the monitor, but also RTFM was involved.</p>
<p>As mentioned I am using minikube to run my k8s cluster which provides PVs stored on the host disk. Where it is stored you may ask? Exaclty, he... |
<p>I see istio is adding <code>x-b3-traceid</code>, <code>x-b3-spanid</code> and other headers to the incoming request when tracing is enabled. But none of them are returned to the caller.</p>
<p>I am able to capture the <code>x-b3-traceid</code> in the log and can find it out in Tempo/Grafana.
I can see the <code>trac... | <p><strong>TL;DR</strong>
these are the headers so that <code>jaeger</code> or <code>zipkin</code> can track individual requests. This application is responsible for their proper propagation. Additionally, they are <strong>request headers</strong> and <strong>not response header</strong>, so everything works fine.</p>
... |
<p>We're already using <a href="https://hub.tekton.dev/tekton/task/gitlab-set-status" rel="nofollow noreferrer">the <code>gitlab-set-status</code> Task from Tekton Hub</a> to report our Tekton Pipeline's status back into our GitLab instance (here's <a href="https://github.com/jonashackt/tekton-argocd-eks" rel="nofollow... | <p><a href="https://github.com/tektoncd/pipeline/releases/tag/v0.14.0" rel="nofollow noreferrer">In v0.14 Tekton introduced the so called <code>finally</code> Tasks</a>, which run at the end of every <code>Pipeline</code> - regardless which Task failed or succeeded. <a href="https://tekton.dev/docs/pipelines/pipelines/... |
<p>I'm trying to configure EFK stack in my local minikube setup. I have followed <a href="https://www.metricfire.com/blog/logging-for-kubernetes-fluentd-and-elasticsearch/" rel="nofollow noreferrer">this tutorial</a>.</p>
<p>Everything is working fine (I can see all my console logs in kibana and Elasticsearch). But I h... | <p>If a pod crashes, all logs still will be accessible in <code>efk</code>. No need to add a persistent volume to the pod with your application only for storing log file.</p>
<p>Main question is how to get logs from this file. There are <strong>two main approaches</strong> which are suggested and based on kubernetes do... |
<p>Running on Kubernetes v1.20</p>
<p>I have a startup probe configured and a liveness probe. On the first start of the container, the startup probe is executed until the liveness probe takes over (as documented). However, it seems if the liveness probe fails and the container restarts, the startup probe is not execute... | <p>Might want to check if your K8 version is the one affected by this issue:</p>
<p><a href="https://github.com/kubernetes/kubernetes/issues/101064" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/101064</a></p>
<p>or</p>
<p><a href="https://github.com/kubernetes/kubernetes/issues/102230" rel=... |
<p>I'm using fluent-bit to collect logs and pass it to fluentd for processing in a Kubernetes environment. Fluent-bit instances are controlled by DaemonSet and read logs from docker containers.</p>
<pre><code> [INPUT]
Name tail
Path /var/log/containers/*.log
Parser docker
Tag kube.*
M... | <p>Try change your fluent-bit config that points to fluentd service as <strong>monitoring-logservice.dips:24224</strong></p>
|
<p>I have 1 master and 2 nodes running and kube-proxy to debug.</p>
<pre><code>kube-m1:/$ kubectl get pod -n kube-system kube-proxy-tmt58
NAME READY STATUS RESTARTS AGE
kube-proxy-tmt58 1/1 Running 6 439d
</code></pre>
<p>How can I specify a namespace to get <code>kubectl logs</cod... | <p>Just like you did it to get a pod, to specify a namespace you can pass <code>-n</code> | <code>--namespace</code> flag, so your command would look like</p>
<pre><code>kubectl logs kube-proxy-tmt58 -n kube-system
</code></pre>
|
<p>We have below chart structure in helm which can deploy 'a microservice' to our k8s cluster</p>
<pre><code>service-chart
|_templates
|_deployment.yaml
|_Ingress.yaml
|_service.yaml
|_Chart.yaml
|_valueBase.yaml
|_valueForService1.yaml
|_valueForService2.yaml
..
..
|_valueForService{n}.yaml
</code></pre>
<p><co... | <p>What you're looking for is <a href="https://github.com/roboll/helmfile" rel="nofollow noreferrer"><code>helmfile</code></a></p>
<ol>
<li><p>Store your base chart and services values in the same folder.</p>
</li>
<li><p>Create <code>helmfile.yml</code>.</p>
<pre><code>releases:
- name: service1
labels:
ap... |
<p>I'm trying to start minikube on a Mac M1 (macOs Monterey V12.0.1) after installing minikube with homebrew (<code>brew install minikube</code>) but I am getting an error after running <code>minikube start</code>.</p>
<p>The error in the logs is this one:</p>
<pre><code>💢 initialization failed, will try again: wait:... | <p>I was able to find the solution to my problem, although, I'm not really sure what was the main issue, it seems that it was related to old configurations in the <code>.minikube</code> folder in the users' home directory.</p>
<p>To fix it, first I had to enabled Kubernetes in docker desktop, and then I had to stop and... |
<p>I just lost access to my k3s.</p>
<p>I had the certs check this week to if if they had been auto-updated... and it seen so:</p>
<pre><code>[root@vmpkube001 tls]# for crt in *.crt; do printf '%s: %s\n' "$(date --date="$(openssl x509 -enddate -noout -in "$crt"|cut -d= -f 2)" --iso-86... | <p>To ignore this error, follow these steps:</p>
<p><strong>Step 1. Stop k3s</strong></p>
<pre><code>systemctl stop k3s.service
</code></pre>
<p><strong>Step 2. Stop time sync</strong></p>
<pre><code>hwclock --debug
timedatectl set-ntp 0
systemctl stop ntp.service
systemctl status systemd-timesyncd.servi... |
<p>Here is my values.yaml file:</p>
<pre><code>options:
collection: "myCollection"
ttl: 100800
autoReconnect: true
reconnectTries: 3
reconnectInterval: 5
</code></pre>
<p>Now I'm trying to convert it into JSON in my configMap like this:</p>
<pre><code>options: {
{{- range $key, $val := .Values.options }}... | <p>The simplest way to increment the counter in your case would be to replace</p>
<pre><code>{{ $c := $c add 1 }}
</code></pre>
<p>with</p>
<pre><code>{{ $c = add1 $c }}
</code></pre>
|
<pre><code> kubectl cp namespace/podname:/path/target .
</code></pre>
<p>If I use the instructed command from kubernetes guide, it only copies the contents inside the <code>target</code> directory and omits <code>target</code> itself.<br />
I don't want to use <code>mkdir</code> every time I need to copy.<br />
What's ... | <p>Try <code>kubectl cp namespace/podname:/path/target target</code>. Note specify "./target" will receive a warning: "tar: removing leading '/' from member names". Also, ensure your image have <code>tar</code> command or <code>kubectl cp</code> can fail.</p>
|
<p>I am trying to deploy an ASP.NET Core Web API service that receives messages in Service Bus using Docker / Azure Kubernetes, but am having trouble with the port blocked.</p>
<p>Here is my deployment files:</p>
<p><strong>Dockerfile</strong></p>
<pre><code>FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app... | <p>Thank you <a href="https://stackoverflow.com/users/10008173/david-maze">David Maze</a>. Posting your suggestion as an answer to help other community members.</p>
<blockquote>
<p>You seem to have included two PNG files in place of your YAML files. Those aren't searchable or runnable; <code>kubectl apply -f</code> wil... |
<p>Since I'm developing on an M1 mac, my Docker builds will build ARM. I want to build x86_64 images which I know I can build with the <code>--platform</code> flag but I want to do that with my Skaffold configuration.</p>
| <p>Thanks to @p10l putting me on the right track, I was able to figure it out. Skaffold can't set the platform using the Docker Engine API, so we need to pass <code>--platform=linux/x86_64</code> to the command line by setting <code>useDockerCLI</code> to <code>true</code> and adding <code>cliFlags</code> to our Docker... |
<p>By using the reference of <a href="https://learn.microsoft.com/en-us/azure/aks/csi-secrets-store-nginx-tls" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/aks/csi-secrets-store-nginx-tls</a> this document, I'm trying to fetch the TLS secrets from AKV to AKS pods.
Initially I created and configured... | <p>i added this as a new answer, bcs the formatting was bad in the comments:</p>
<p>As you are using the Helm chart, you have to activate the secret sync in the <code>values.yaml</code> of the Helm Chart:</p>
<pre><code>secrets-store-csi-driver:
syncSecret:
enabled: true
</code></pre>
<p>I would still recommend t... |
<p>I have a pod that exposes a port (Server). Other pods (Clients) can communicate with it.</p>
<p>The server can find remote IP and port on a socket (when the client connects to it). I am looking for a way to get the client's pod name (from its IP and port).</p>
<p>I saw a bunch of questions/answers about getting pod ... | <p>List all the Pods with the <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#list-pod-v1-core" rel="nofollow noreferrer"><em>List Pods</em></a> API operation and parse the JSON response for the <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#podstatus-v1-core... |
<p>We are bringing up a Cassandra cluster, using k8ssandra helm chart, it exposes several services, our client applications are using the datastax Java-Driver and running at the same k8s cluster as the Cassandra cluster (this is testing phase)</p>
<pre><code>CqlSessionBuilder builder = CqlSession.builder();
</code></pr... | <p>The k8ssandra Helm chart deploys a CassandraDatacenter object and cass-operator in addition to a number of other resources. cass-operator is responsible for managing the CassandraDatacenter. It creates the StatefulSet(s) and creates several headless services including:</p>
<ul>
<li>datacenter service</li>
<li>seeds ... |
<p>I have 3 masters, several workers and Calico as cni. Pods created on masters get <code>172.17.0.*</code> IPs and this is docker network. Pods on workers get IP from calico pool as it should be. <code>calicoctl</code> shows <code>status ok</code> for all nodes.</p>
<p>Also I have same kubelet parameters and config fi... | <p>Posted community wiki based on comments for better visibility. Feel free to expand it.</p>
<hr />
<p>The solution for the issue is to add flag <code>--network-plugin=cni</code> to Kubelet startup options on the masters nodes (from the @mzv comment):</p>
<blockquote>
<p>I needed to add "--network-plugin=cni"... |
<p>I have Celery workers running on Kubernetes 1.20 cluster on AWS EKS using AWS Elasticache Redis as the broker. Because of the nature of the project ~80% of the time celery workers are running idle so the logical thing was to have them scale automatically. Scaling based on CPU/memory works ok. At about 4 workers node... | <blockquote>
<p>Conclusion: <code>celery inspect</code> is not a good <code>startupProbe</code> candidate.</p>
</blockquote>
<p>I agree.</p>
<p>You also mentioned that you have an active <code>healtcheck</code></p>
<blockquote>
<p>I have in another container a web service that uses Django framework and exposes health c... |
<p>I am running this Cronjob at 2 AM in the morning:</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: postgres-backup
spec:
# Backup the database every day at 2AM
schedule: "0 2 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: po... | <p>If only last job and pod need to be preserved, you can use <code>.spec.successfulJobsHistoryLimit</code> field set to <code>1</code>.</p>
<p>This way only last job and corresponding pod will be preserved. By default it's set to <code>3</code>. Also it's possible to set this value to <code>0</code> and nothing will b... |
<p>I'm running Docker Desktop 3.6.0 on Windows 10 with WSL2.
When I try to enable Kubernetes I only see "Failed to start" within the Docker Desktop UI.
Docker itself works fine. Not sure how I can get any further logs.</p>
<p>Here the output from kubectl version:</p>
<pre><code>kubectl version
Client Version:... | <p>High level answer...</p>
<ol>
<li>Get a docker registry
<ol>
<li>If you work for an old skool cool enterprise; use <a href="https://jfrog.com/artifactory" rel="nofollow noreferrer">JFrog Artifactory</a></li>
<li>If you just want to get it to work; use <a href="https://goharbor.io/" rel="nofollow noreferrer">Harbor</... |
<p>Today my kubernetes cluster(v1.15.2) node disk full and cause pods give this tips:</p>
<pre><code>Update plugin resources failed due to failed to write checkpoint file "kubelet_internal_checkpoint": write /var/lib/kubelet/device-plugins/.261578065: no space left on device, which is unexpected.
MountVolume.SetUp fai... | <p>Other possibility is incorrect unit values for resource requests/limits (ex, using <code>mi</code> instead of <code>Mi</code>).</p>
<p>For example:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
spec:
containers:
- name: {container_name}
resources:
limits:
... |
<p>I am wondering if Kubernetes can automatically move the pods to another node if that node resources are on critical, or if that happens only for pods managed by Replica Sets?</p>
<p>In particular:</p>
<ol>
<li>What happens when a <strong>bare pod</strong> (not managed by Replica Sets or similar) is evicted? Is it mo... | <blockquote>
<ol>
<li>What happens when a <strong>bare pod</strong> (not managed by Replica Sets or similar) is evicted? Is it moved to another node or it is just removed?</li>
</ol>
</blockquote>
<p>Pod is <a href="https://kubernetes.io/docs/concepts/workloads/pods/#working-with-pods" rel="nofollow noreferrer">desig... |
<p>I have an application deployed to kubernetes.
Here is techstack:
<em>Java 11, Spring Boot 2.3.x or 2.5.x, using hikari 3.x or 4.x</em></p>
<p>Using spring actuator to do healthcheck. Here is <code>liveness</code> and <code>readiness</code> configuration within application.yaml:</p>
<pre><code> endpoint:
health:... | <ol>
<li>As you answered to yourself, it spinned new pods after 3 times tries according to <code>failureThreshold</code>. You can change your <code>restartPolicy</code> to <code>OnFailure</code>, it will allow you to restart the job only if it fails or <code>Never</code> if you don't want have the cluster to be restart... |
<p>I run Minio on a kubernetes cluster since May. Everything worked fine. Since the last action, updated ingress from Traefik to Nginx ingress, I cannot login to the Minio Console anymore.</p>
<p>I do not really know if this happen before or after the ingress update. But in all I think this is not the reason.</p>
<p>Th... | <p><strong>Solution 1:</strong></p>
<p>The auth issue can be faced due to an expired <code>apiserver-kubelet-client.crt</code>. If it's expired, try to renew the cert and restart the apiserver.</p>
<p>In order to do this:</p>
<ul>
<li>check if the cert is expired</li>
<li>remove expired certificates(.crt)</li>
<li>exec... |
<p>Let's say we have a frontend and a backend pods running in a kubernetes cluster.</p>
<p>Both pods have corresponding services exposing them on the host (type: <code>NodePort</code>). In the end, the frontend uses <code><Host IP>:<Port 1></code>, and the backend runs on <code><Host IP>:<Port 2>... | <p>Use the <a href="https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/" rel="noreferrer">downward API</a>:</p>
<pre><code>spec:
image: ...
env:
- name: REACT_APP_BACKEND_URL
valueFrom:
fieldRef:
fieldPath: status.hostIP
</code></pre>
|
<p>I restarted my mac (Mac OS High Sierra) and now Visual Studio code can't find kubectl binary even it is installed via brew.</p>
<pre><code>$ which kubectl
/usr/local/bin/kubectl
</code></pre>
<p><a href="https://i.stack.imgur.com/fKTSg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fKTSg.png" alt="enter... | <p>adding the below config is vscode settings.json may resolve this</p>
<pre><code>"vs-kubernetes": {
"vscode-kubernetes.minikube-path.mac": "/path/to/minikube",
"vscode-kubernetes.kubectl-path.mac": "/path/to/kubectl",
"vscode-kubernetes.helm-path.mac&... |
<p>I have a same <a href="https://github.com/k3s-io/k3s/discussions/4488" rel="nofollow noreferrer">discussion</a> in k3s github repository, but no one reply. Hope someone can give an answer here.</p>
<p>There are articles talking about the embedded etcd HA solution of k3s like <a href="https://blog.alexellis.io/bare-m... | <p>I got a response from the k3s discussion:</p>
<p><a href="https://github.com/k3s-io/k3s/discussions/4488#discussioncomment-1719009" rel="nofollow noreferrer">https://github.com/k3s-io/k3s/discussions/4488#discussioncomment-1719009</a></p>
<blockquote>
<p>Our documentation lists a requirement for a "fixed regist... |
<p>skaffold version
v1.35.1</p>
<p>Using <a href="https://kind.sigs.k8s.io/docs/user/local-registry/" rel="nofollow noreferrer">local registry:2</a> in KinD cluster.</p>
<p><code>kubectl config current-context</code> > kind-kind. And kubectl config view, shows the right url for <code>kind-kind</code> to the server: ... | <p>Running skaffold with the <code>--kubeconfig <path to kubeconfig file></code> should to the trick.</p>
|
<p>I am new to k8's and trying to update storageClassName in a StatefulSet.(from default to default-t1 only change in the yaml)</p>
<p>I tried running <code>kubectl apply -f test.yaml</code></p>
<p>The only difference between 1st and 2nd Yaml(one using to apply update) is storageClassName: default-t1 instead of defau... | <p>There's no easy way as far as I know but it's possible.</p>
<ol>
<li>Save your current StatefulSet configuration to yaml file:</li>
</ol>
<pre><code>kubectl get statefulset some-statefulset -o yaml > statefulset.yaml
</code></pre>
<ol start="2">
<li>Change <code>storageClassName</code> in <code>volumeClaimTemplat... |
<p>If a Helm deployment's status is <code>failed</code>, what can I do to determine what made it fail?</p>
| <p><code>helm history <chartname></code></p>
<p>Shows the kubernetes errors for the attempted deployment of that chart.</p>
|
<p>What happens when Kubernetes <code>liveness-probe</code> returns false?
Does Kubernetes restart that pod immediately?</p>
| <p>First, please note that <code>livenessProbe</code> concerns <strong>containers</strong> in the pod, not the pod itself. So if you have multiple containers in one pod, only the affected container will be restarted.</p>
<p>It's worth noting, that there is <a href="https://kubernetes.io/docs/tasks/configure-pod-contain... |
<p>I have a service which is running in kubernetes, and has a path prefix <code>/api</code>. Now I want to use Ingress to access it through the host address <code>example.com/service1/</code> because I have multiple services. But the problem is that ingress redirects all the requests from path <code>service1/</code> wi... | <p><em>This is a community wiki answer posted for better visibility. Feel free to expand it.</em></p>
<p>Based on the solution provided in the comments (method 1 example 2 in the Medium <a href="https://medium.com/ww-engineering/kubernetes-nginx-ingress-traffic-redirect-using-annotations-demystified-b7de846fb43d" rel="... |
<p>I have a question about Kubernetes enviroment. I have K8s cloud and after what I add assign one Persistent volume to one pod, this pod is still in "ContainerCreating" status. This PV has assign PVC correctly. PVC is on two external GlusterFS servers with replica 2. </p>
<p><strong>PV look like this:</strong></p>
<... | <p>To see what is wrong, check the events:</p>
<pre><code>kubectl get events --sort-by=.metadata.creationTimestamp
</code></pre>
|
<p>I am trying to figure out <strong>how to get pod labels into the metric tags from kubelet metrics using prometheus-stack</strong>. In our environment, we need to hash pod names (due to length limitations) so our app name, env, and unit name are saved in pod labels.</p>
<p>We are using prometheus-stack (helm installa... | <p>As far as I know you can really use filtering metrics <a href="https://stackoverflow.com/questions/60067654/prometheus-filtering-based-on-labels">based on pod labels</a>. Look at the original answer:</p>
<blockquote>
<p>You can use <code>+</code> operator to join metrics. Here, <code>group_left()</code> will inc... |
<p>I have created an AKS cluster. Is Azure generating the following PKI certificate for us?</p>
<p><a href="https://kubernetes.io/docs/setup/best-practices/certificates/#how-certificates-are-used-by-your-cluster" rel="nofollow noreferrer">https://kubernetes.io/docs/setup/best-practices/certificates/#how-certificates-ar... | <p>Yes, AKS manages all these certificates for you, with the exception of:</p>
<blockquote>
<p>Client certificates for administrators of the cluster to authenticate to the API server</p>
</blockquote>
<p>Because AKS hands out access tokens in the form of JWTs.</p>
|
<p>If I have two pods running on different namespaces, and there is netpol already setup and cannot be modified, how would I approach the POD to POD communication making the ingress and egress possible again without modifying the existing object?</p>
| <p>User <a href="https://stackoverflow.com/users/1153938/vorsprung" title="30,068 reputation">Vorsprung</a> has good mentioned in the comment:</p>
<blockquote>
<p>The netpolicy that is already there probably does a general ingres / egress block. If you add another policy that specifically allows the POD to POD you need... |
<p>I want to get the status code of my command executed in a container with Fabric8 Java Kubernetes client.</p>
<p>Here is the script located in my container:</p>
<pre><code>echo Bye Bye
exit 1
</code></pre>
<p>When I run the script with CLI or NodeJS Client I am able to get the output status code</p>
<p>Here is an exa... | <p>It is possible by using the <code>wri</code> method:</p>
<p>Can use the <code>.writingErrorChannel</code> and parse the response:</p>
<pre><code>{
"metadata": {},
"status": "Failure",
"message": "command terminated with non-zero exit code: exit status 1",... |
<p>I have a ConfigMap with multiple files, and want to add these files to an already existing directory. But the tricky part here is, the filenames(keys) can change. So I can't try to mount them individually using subPath.</p>
<p>Is there any way this can be achieved from Deployment manifest?</p>
<p>Configmap:</p>
<pre... | <p>You can use the <strong>init container</strong> with <strong>configmap</strong> as a <strong>volume</strong> mount.</p>
<p>Not sure about the actual deployment architecture.</p>
<p>i would suggest injecting the configmap files to another directory and copying and pasting at starting of the main container.</p>
<p>Usi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.