prompt
stringlengths
65
38.7k
response
stringlengths
41
29.1k
<p>I am new to Kubernetes. I was going through some tutorials related to Kubernetes deployment. I am seeing two different commands which looks like doing similar things.</p> <ol> <li><p>The below command is from google code lab (URL: <a href="https://codelabs.developers.google.com/codelabs/cloud-springboot-kubernetes/i...
<p>There are cases where the <code>expose</code> command is not sufficient &amp; your only practical option is to use <code>create service</code>.</p> <p>Overall there are 4 different types of Kubernetes services, for some it really doesn't matter if you use expose or create, while for others it maters very much.</p> ...
<p>We have recently setup istio on our kubernetes cluster and are trying to see if we can use RequestAuthentication and AuthenticationPolicy to enable us to only allow a pod in namespace x to communicate with a pod in namespace y when it has a valid jwt token.</p> <p>All the examples I have seen online seem to only app...
<p>Yes, it is possible to use both Authorization Policies and Request Authentications.</p> <p>But debugging is quite difficult because a lot is based on your environment and the JWT that is being used, and so on.</p> <p>To troubleshoot these kinds of issues I'd start by setting the rbac scoped logs to debug for the ser...
<p>I've a NextJS app which needs a .env file mounted. I usually do this with providing a configMap:</p> <pre class="lang-yaml prettyprint-override"><code>kind: ConfigMap apiVersion: v1 metadata: name: frontend-configmap namespace: default data: .env: |- NEXT_PUBLIC_API_URL=http://my.domain.com API_URL=htt...
<p>You need to have <code>.env</code> file created first. And ideally even creating configmaps should be based on the existing file (below are examples for <code>kustomize</code> and <code>kubectl --from-file</code>).</p> <p>Then there are two options how to create a configmap:</p> <ul> <li>create <code>.env</code> fil...
<p>From the official AWS documentation, I get the following:</p> <blockquote> <p>AWS treats Regions and Availability Zones as failure domains that should be accounted for when running infrastructure that needs to be highly available.</p> </blockquote> <blockquote> <p>Each Region where your application is deployed shoul...
<p>EKS won't work to spread nodes out across AZ's. EKS doesn't concern itself with nodes or rather nodegroups so much. Heck, it doesn't even know what workloads it's going to be scheduling. EKS is just providing the K8s control plane.</p> <p>Instead, you need to build a nodegroup in each AZ that's part of the cluster....
<p>I have defined a <code>validatingWebhook</code> configuration with a custom controller that is deployed as a deployment, snippet below for <code>validatingWebhook</code>:</p> <pre><code>apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: validate-webhook namespace: ad...
<p>It's passing through the validation controller due to it's set as <code>scope: &quot;Namespaced&quot;</code> and I can't see any <code>namespace</code> specified in your nginx deployment file. You can add any working <code>namespace</code> or change your <code>scope</code> to <code>&quot;*&quot;</code></p> <p>...
<h2>Background and Context</h2> <p>I am working on a Terraform project that has an end goal of an EKS cluster with the following properties:</p> <ol> <li>Private to the outside internet</li> <li>Accessible via a bastion host</li> <li>Uses worker groups</li> <li>Resources (deployments, cron jobs, etc) configurable via t...
<p>See how your node group is communicate with the control plane, you need to add the same cluster security group to your bastion host in order for it to communicate with the control plane. You can find the SG id on the EKS console - Networking tab.</p>
<p>In the following pod yaml, I cannot get <code>source</code> command to work. Initially I inserted the command under <code>args</code> between <a href="https://stackoverflow.com/questions/33887194/how-to-set-multiple-commands-in-one-yaml-file-with-kubernetes"><code>echo starting</code> and <code>echo done</code></a> ...
<p>After experimenting with the suggestions under <a href="https://unix.stackexchange.com/questions/101168/set-environment-variable-automatically-upon-ssh-login-no-root-access">set-environment-variable-automatically-upon-ssh-login</a>, what worked was to substitute</p> <pre><code>echo CONT1=\&quot;mubu621\&quot; &gt;&g...
<p>I have created Mongodb stateful set using <a href="https://github.com/mongodb/mongodb-kubernetes-operator" rel="nofollow noreferrer">mongodb kubernetes operator</a>.</p> <p>Now I want to delete that stateful set from kubernetes dashboard, but it is getting recreated again and again.</p> <p>How do we delete stateful ...
<blockquote> <p>How do we delete stateful set permanently so that it doesn't get created again.</p> </blockquote> <p>List and check the name of statefulset</p> <pre><code>kubectl get statefulsets -n &lt;namespace name&gt; </code></pre> <p>Command to delete the stateful set permanently</p> <pre><code>kubectl delete stat...
<p>I'm writing a controller for a k8s CRD.</p> <p>The job the controller has to do will usually be quick, but could on occasion take a really long time - let's say as much as an hour.</p> <p>Is that ok for a Reconcile? Or should I move that work out of the controller into a separate pod, and have the controller monitor...
<p>I see no reason why the reconcile loop couldn't take as long as you need.</p> <p>Technically speaking a reconcile is just getting a copy of a resource i.e. an HTTP Get or an event if you're using the Watch API, followed by a change to the resource e.g updating the resource Status fields i.e an HTTP PUT/POST.</p> <p>...
<p>I am trying to debug my pod throwing CrashLoopBackOff error. When I run decribe command, I found that <code>Back-off restarting failed container</code> is the error. I excuted the logs for the failing pod and I got the below data.</p> <pre><code>vagrant@master:~&gt; kubectl logs pod_name standard_init_linux.go:228: ...
<p>Summarizing the comments: <code>CrashLoopBackOff</code> error occurs, when there is a mismatch of AMD64 and ARM64 devices. According to your docker image <code>udacity/nd064-udaconnect-app</code>, we can see that it's <a href="https://hub.docker.com/r/udacity/nd064-udaconnect-app/tags" rel="nofollow noreferrer">AMD6...
<p>I want to add a new cluster in addition to the default cluster on ArgoCD but when I add it, I get an error:<br /> FATA[0001] rpc error: code = Unknown desc = REST config invalid: the server has asked for the client to provide credentials<br /> I use the command <code>argocd cluster add cluster-name</code><br /> I do...
<p>I solved my problem but welcome other solutions from everyone :D<br /> First, create a secret with the following content:</p> <pre><code>apiVersion: v1 kind: Secret metadata: namespace: argocd # same namespace of argocd-app name: mycluster-secret labels: argocd.argoproj.io/secret-type: cluster type: Opaque...
<p>I was looking for a way to stream the logs of all pods of a specific deployment of mine.<br /> So, some days ago I've found <a href="https://stackoverflow.com/a/56258727/12603421">this</a> SO answer giving me a magical command:</p> <pre><code>kubectl logs -f deployment/&lt;my-deployment&gt; --all-containers=true </c...
<p>To return all pod(s) log of a deployment you can use the same selector as the deployment. You can retrieve the deployment selector like this <code>kubectl get deployment &lt;name&gt; -o jsonpath='{.spec.selector}' --namespace &lt;name&gt;</code>, then you retrieve logs using the same selector <code>kubectl logs --se...
<p>I have a docker private registry.Now I want to pull image in minikube</p> <pre><code>kubectl run test --image=docker-registry.localdomain/others/test:latest --port=8077 --generator=run/v1 </code></pre> <p>but I get an error</p> <pre><code>Failed to pull image &quot;docker-registry.localdomain/others/test:latest&quot...
<p>Solution :<br> 1.Create new certificates in docker registry using : <br></p> <pre><code>openssl req -x509 -out registry.crt -keyout registry.key -days 1825 \ -newkey rsa:2048 -nodes -sha256 \ -subj '/CN=your-retistry.com' -extensions EXT -config &lt;( \ printf &quot;[dn]\nCN=your-retistry.com\n[req]\ndistingu...
<p>We have some process which create some artifices in specific namespace in k8s, one of the artifacts is a secret which is created in this namespace (e.g. ns1). The problem is that this secret needs to be used also from different namespace (apps in ns1 and ns2 needs to use it ) , which option do I have in this case? S...
<p>i would suggest the checking out : <a href="https://github.com/zakkg3/ClusterSecret" rel="nofollow noreferrer">https://github.com/zakkg3/ClusterSecret</a></p> <p>Cluster secret automate the process the cloning the secrets across the namespaces.</p> <p>when you need a secret in more than one namespace. you have to:</...
<p>I am new to kubernetes and using AWS EKS cluster 1.21. I am trying to write the nginx ingress config for my k8s cluster and blocking some request using <strong>server-snippet</strong>. My ingress config is below</p> <pre><code>apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: abc-ingress-external na...
<p>Seems there's <a href="https://github.com/kubernetes/ingress-nginx/issues/5738#issuecomment-971799464" rel="nofollow noreferrer">issue</a> using <code>location</code> with some versions. The following was tested successfully on EKS cluster.</p> <p>Install basic ingress-nginx on EKS:</p> <p><code>kubectl apply -f htt...
<p>yaml file and in that below values are defined including one specific value called &quot;environment&quot;</p> <pre><code>image: repository: my_repo_url tag: my_tag pullPolicy: IfNotPresent releaseName: cron_script schedule: &quot;0 10 * * *&quot; namespace: deploy_cron rav_admin_password: asdf environment: test...
<p>This is a syntax problem of variables and local variables.</p> <p>The <code>fwip</code> in <code>if</code> should use <code>=</code> instead of <code>:=</code></p> <pre class="lang-yaml prettyprint-override"><code>{{- $fwip := .Values.prod_us_forwarder_ip }} {{- if contains .Values.environment &quot;testing&quot; }...
<p>When i do this command <code>kubectl get pods --all-namespaces</code> I get this <code>Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.</code></p> <p>All of my pods are running and ready 1/1, but when I use this <code>microk8...
<p>Posting answer from comments for better visibility: Problem solved by reinstalling multipass and microk8s. Now it works.</p>
<h2>Setup description</h2> <p>I have the following scenario: Created a Build Pipeline in Azure DevOps and after setting up my Kubernetes cluster I want to get a specific pod name using kubectl. I am doing this via the "Deploy to Kubernetes" task V1, which looks like this:</p> <pre><code>steps: - task: Kubernetes@1 ...
<p>If you give the NAME for the kubectl task eg. SomeNameForYourTask like below</p> <pre><code>- task: Kubernetes@1 name: SomeNameForYourTask displayName: some display name inputs: connectionType: Kubernetes Service Connection ... </code></pre> <p>you will be able to access kubectl command output using...
<p>I was reviewing some material related to kubernetes security and I found it is possible to expose Kubernetes API server to be accessible from the outside world, My question is what would be the benefit from doing something vulnerable like this, Anyone knows business cases for example that let you did that? Thanks</p...
<p>Simply, you can use endpoints to deploy any service from your local. for sure you must implement security on your api. I have created an application locally which builds using docker api, and deploy using kubernetes api. Don't forget about securing your apis.</p>
<p>I am trying to host an application in <strong>AWS Elastic Kubernetes Service(EKS)</strong>. I have configured the EKS cluster using the AWS Console. Configured the Node Group and added a Node to the EKS Cluster and everything is working fine.</p> <p>In order to connect to the cluster, I had spin up an EC2 instance (...
<p>Check your cluster role binding or user access to EKS cluster</p> <pre><code>--- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: eks-console-dashboard-full-access-clusterrole rules: - apiGroups: - &quot;&quot; resources: - nodes - namespaces - pods verbs: - get - list - a...
<p>My kubernetes K3s cluster gives this error:</p> <pre><code>Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedScheduling 17m default-scheduler 0/2 nodes are available: 1 node(s) didn't match Pod's node affinity/sele...
<p>Posting the answer as a community wiki, feel free to edit and expand.</p> <hr /> <p><code>node.kubernetes.io/disk-pressure:NoSchedule</code> taint indicates that some disk pressure happens (as it's called).</p> <blockquote> <p>The <code>kubelet</code> detects disk pressure based on <code>imagefs.available</code>, <c...
<p>I am trying to access the content(json data) of a file which is passed as input artifacts to a script template. It is failing with the following error <code>NameError: name 'inputs' is not defined. Did you mean: 'input'?</code></p> <p>My artifacts are being stored in aws s3 bucket. I've also tried using environment ...
<p>In the last template, replace <code>{{inputs.artifacts.result}}</code> with <code>”/tmp/templates_lst.txt”</code>.</p> <p><code>inputs.artifacts.NAME</code> has no meaning in the <code>source</code> field, so Argo leaves it as-is. Python tries to interpret it as code, which is why you get an exception.</p> <p>The pr...
<p>I've deployed the redis helm <a href="https://github.com/bitnami/charts/tree/master/bitnami/redis" rel="nofollow noreferrer">chart</a> on k8s with Sentinel enabled.</p> <p>I've set up the Master-Replicas with Sentinel <a href="https://github.com/bitnami/charts/tree/master/bitnami/redis#master-replicas-with-sentinel"...
<p>Instead of using IPs, you may use the dns entries for a headless service.</p> <p>A headless service is created by explicitly specifying</p> <pre><code>ClusterIP: None </code></pre> <p>Then you will be able to use the dns entries as under, where redis-0 will be the master</p> <pre><code>#syntax pod_name.service_name....
<p>I have an Angular + Spring boot microservices application where there are about 10 backend microservices. Its a pretty big application with more than may be 100 REST end points. We are thinking to move to on prem kubernetes. I wonder how do I define the ingress file, do I need to define all of the application REST e...
<p>Mostly it depends on your requirement, what you are trying to use.</p> <p>If you are just planning to use the <strong>Nginx</strong> ingress with your sprint boot you can simply use the <strong>Nginx ingress controller</strong> and set the <strong>ingress</strong>.</p> <p>While if you have requirements of <strong>AP...
<p>I'm new to Terraform and Helm world! I need to set up Istio on the AWS EKS cluster. I was able to set up the EKS cluster using Terraform. I'm thinking of installing ISTIO on top of the EKS cluster using Terraform by writing terraform modules. However, I found that we can set up Istio on top of eks using the helm cha...
<p>To extend @Chris 3rd option of terraform + helm provider,</p> <p>as for version 1.12.0+ of istio they officially have a working helm repo:</p> <p><a href="https://istio.io/latest/docs/setup/install/helm/" rel="noreferrer">istio helm install</a></p> <p>and that with terraform's helm provider <a href="https://registry...
<p>I have written a k8s controller with kubebuilder which reconciles my CustomResource object (MyResource).</p> <p>During update, controller-runtime gives me an error 'not found' even though my resource exists on the cluster.</p> <pre><code>func (r *MyResourceReconciler) updateStatus(ctx context.Context, myResource *my...
<p>I was able to resolve this issue myself using:</p> <p><code>r.Update(ctx, myResource)</code> instead of <code>r.Status().Update(ctx, myResource)</code></p>
<p>I'm running into an issue managing my Kubernetes pods.</p> <p>I had a deploy instance which I removed and created a new one. The pod tied to that deploy instance shut down as expected and a new one came up when I created a new deploy, as expected.</p> <p>However, once I changed the deploy, a second pod began runni...
<p>I've had this happen after issuing a <code>rollout restart deployment</code> while a pod was already in an error or creating state, and explicitly deleting the second pod only resulted in a new one getting scheduled (trick birthday candle situation).</p> <p>I find almost any time I have an issue like this it can be ...
<p>I am trying to configure alerts using Alert Manager with Prometheus (using Helm and Kubernetes). On Alert Manager UI, I am getting cluster status as disabled. How do I move it to a ready state?</p> <p><a href="https://i.stack.imgur.com/KcLfv.png" rel="noreferrer">Attaching the image for the same</a></p>
<p>Can you check if <code>--cluster.listen-address</code> is set to blank in your helm chart. Clustering is disabled if the mentioned key is blank.</p>
<p>I noticed some of my clusters were reporting a CPUThrottlingHigh alert for metrics-server-nanny container (image: gke.gcr.io/addon-resizer:1.8.11-gke.0) in GKE. I couldn't see a way to configure this container to give it more CPU because it's automatically deployed as part of the metrics-server pod, and Google auto...
<p><a href="https://github.com/robusta-dev/alert-explanations/wiki/CPUThrottlingHigh-on-metrics-server-(Prometheus-alert)" rel="nofollow noreferrer">This is a known issue with GKE metrics-server.</a></p> <p>You can't fix the error on GKE as GKE controls the metric-server configuration and any changes you make are rever...
<p>I am migrating the Kubernetes deployments from API version <code>extensions/v1beta1</code> to <code>apps/v1</code>.</p> <p>I've changed the API group in deployment to <code>apps/v1</code> and applied the deployment.</p> <p>However when I check the deployment using <code>get deployment -o yaml</code> it's showing dep...
<p>As I understand, you want to view the last applied configuration for the deployments?</p> <p>If yes, you should use <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-view-last-applied-em-" rel="nofollow noreferrer"><code>kubectl apply view-last-applied</code> command</a>.</p> <p>Ex...
<p>I am migrating the Kubernetes deployments from API version <code>extensions/v1beta1</code> to <code>apps/v1</code>.</p> <p>I've changed the API group in deployment to <code>apps/v1</code> and applied the deployment.</p> <p>However when I check the deployment using <code>get deployment -o yaml</code> it's showing dep...
<p>Kubernetes automatically handles API version conversion. This can happen when you upgrade the cluster - or when requesting a resource in a different api version that is supported by your cluster. The stored objects in etcd are always upgraded to the latest version when edited or during creation.</p> <p>If you want t...
<p>I am trying to host an application in <strong>AWS Elastic Kubernetes Service(EKS)</strong>. I have configured the EKS cluster using the AWS Console using an <strong>IAM user (user1)</strong>. Configured the Node Group and added a Node to the EKS Cluster and everything is working fine.</p> <p>In order to connect to t...
<p>When you create an EKS cluster, only the user that created a cluster has access to it. In order to allow someone else to access the cluster, you need to add that user to the aws-auth. To do this, in your <code>data</code> section, add</p> <pre><code>mapUsers: | - userarn: arn:was:iam::&lt;your-account-id&gt;:user/...
<p>I am trying to add google cloud armor to my Terraform project that deploys app using Kubernetes. I follow this example. But, in my case, I want to create this rules instead: <a href="https://github.com/hashicorp/terraform-provider-google/blob/master/examples/cloud-armor/main.tf" rel="nofollow noreferrer">https://git...
<p>First of all I would like to clarify a few things.</p> <p><strong>Cloud Armor</strong></p> <blockquote> <p><a href="https://cloud.google.com/armor/docs/cloud-armor-overview" rel="nofollow noreferrer">Google Cloud Armor</a> provides protection only to applications running behind an external load balancer, and several...
<p>I run <a href="https://prometheus.io/" rel="nofollow noreferrer">prometheus</a> locally as http://localhost:9090/targets with</p> <pre><code>docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus </code></pre> <p>and want to connect it to several Kubernetes (cluster) instances we have. See that scrap...
<p>If I understand your question, you want to monitor kubernetes cluster where prometheus is not installed on remote kubernetes cluster.</p> <blockquote> <p>I monitor many different kubernetes cluster from one prometheus which is installed on a standalone server.</p> </blockquote> <p><em><strong>You can do this by gene...
<p>I am begginer at K8S, i'm using github actions I have 3 environment (dev, pred-prod, prod) and 3 namespace to each environment, i want to have a second environment (pre-prod-2) into my namespace of pre-production; is it possible ? and how the yaml file will look like ?</p> <p>Thank you</p>
<p>To create another independent deployment in the same namespace, take your existing Deployment YAML and change the following fields:</p> <ul> <li>metadata.name</li> <li>spec.selector.matchLabels.app</li> <li>template.metadata.labels.app</li> </ul> <p>It will be sufficient to just append a &quot;2&quot; to each of the...
<p>I have a script which execute on container and i use following command to create my container and exit once execution complete, this is working as per our requirement.</p> <pre><code>kubectl run -i tmp-pod --rm -n=mynamespace --image=placeholder --restart=Never --overrides=&quot;$(cat POD.json)&quot; </code></pre> <...
<p>In your case, as everything is the same, I suggest you run your pod something like this. As far as I know, k8s does not give you a build in solution for this.</p> <pre class="lang-sh prettyprint-override"><code>kubectl run -i tmp-pod$((1 + $RANDOM % 1000000)) --rm -n=mynamespace --image=placeholder --restart=Never -...
<p>I have an on-premise kubernetes cluster v1.22.1 (1 master &amp; 2 worker nodes) and wanted to run jenkins slave agents on this kubernetes cluster using kubernetes plugin on jenkins. Jenkins is currently hosted outside of K8s cluster, running 2.289.3. For Kubernetes credentials in Jenkins Cloud, I have created new s...
<p>Under your pod spec you can add <code>automountServiceAccountToken: false</code>. As described <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server" rel="nofollow noreferrer">here</a></p> <pre class="lang-yaml prettyprin...
<p>I have a Kubernetes cluster with the followings:</p> <ul> <li>A deployment of some demo web server</li> <li>A ClusterIP service that exposes this deployment pods</li> </ul> <p>Now, I have the cluster IP of the service:</p> <pre><code>NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ...
<blockquote> <p>does that mean within a container (pod) in the cluster? or even from the nodes themselves</p> </blockquote> <p>You can access the ClusterIP from KubeNode and pods. This IP is a virtual IP, and It only works within the cluster. One way it works is ( apart from CNI), Using Linux kernel's <code>iptables</c...
<p>I have a Helm chart containing two subcharts, <code>charts/subchart1</code> and <code>charts/subchart2</code>. Each of the subcharts has its own <code>values.yaml</code>, <code>templates/deployment.yaml</code>, and similar files.</p> <p>In the parent chart's <code>values.yaml</code> file I am using a parameter like...
<p>This is achievable, but it will be more complicated.</p> <p>❗❗❗ You may need to learn a few concepts first.</p> <ol> <li><a href="https://helm.sh/docs/chart_template_guide/subcharts_and_globals/" rel="nofollow noreferrer">Subcharts and Global Values</a></li> <li><a href="https://helm.sh/docs/helm/helm_dependency/" r...
<p>I followed the official walkthrough on how to deploy MySQL as a statefulset here <a href="https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/</a></p> <p>I have it up and ...
<p>You have to use the <strong>service name</strong> for connecting with the <strong>MySQL</strong> from Go application.</p> <p>So your traffic flow like</p> <p>Go appliction POD running inside same K8s cluster as POD inside the container</p> <p>send a request to MySQL service -&gt; MySQL service forward traffic to <st...
<p>I am trying to create a KEDA scaled job based on RabbitMQ queue trigger but encountered an issue when pods are not scaling at all.</p> <p>I have created a following Scaled job and lined up messages in the queue but no pods are created. I see this <strong>message: Scaling is not performed because triggers are not act...
<p><a href="https://stackoverflow.com/a/67319005/2777988">mode may not work in some cases.</a></p> <p>Try changing</p> <pre><code>- metadata: host: amqp://guest:guest@rabbitmq.sandbox-dev.svc.cluster.local:5672/vhost mode: QueueLength queueName: celery value: '1' </code></pre> <p>to</p> <pre><code>- met...
<p>I'm trying to deploy my k8s cluster. But when I do, it can't pull the image. Here's what I get when I run <code>kubectl describe pods</code>:</p> <pre><code> Type Reason Age From Message ---- ------ ---- ---- ------- Normal Back...
<p>You must create a secret to your registry in kubectl:</p> <pre><code>kubectl create secret docker-registry &lt;secret-name&gt; \ --namespace &lt;namespace&gt; \ --docker-server=&lt;container-registry-name&gt;.azurecr.io \ --docker-username=&lt;service-principal-ID&gt; \ --docker-password=&lt;service-principal-passwo...
<p>I have a TCP service. I created a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-tcp-liveness-probe" rel="nofollow noreferrer">TCP readiness probe</a> for my service which appears to be working just fine.</p> <p>Unfortunately, my EC2 target gro...
<p>TCP is a valid protocol for health checks in 2 cases:</p> <ol> <li>the classic flavor of the ELB, <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-healthchecks.html#health-check-configuration" rel="nofollow noreferrer">see docs</a></li> <li>The network load balancer, <a href="https://docs...
<p>I deleted my cluster-admin role via kubectl using:</p> <p><code>kubectl delete clusterrole cluster-admin</code></p> <p>Not sure what I expected, but now I don't have access to the cluster from my account. Any attempt to get or change resources using kubectl returns a 403, Forbidden. Is there anything I can do to rev...
<p>Try applying this YAML to creaste the new Cluster role</p> <pre><code>apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: annotations: rbac.authorization.kubernetes.io/autoupdate: &quot;true&quot; labels: kubernetes.io/bootstrapping: rbac-defaults name: cluster-admin rules: - apiGroups...
<p>I'm working on developing a k8s custom resource that as part of the business logic needs to reconcile its state when an external Job in the cluster have changed its own state.</p> <p>Those Jobs aren't created by the custom resource itself but are externally created for a third party service, however I need to reconc...
<p>By design, the event that triggered reconciliation is not passed to the reconciler so that you are forced to define and act on a state instead. This approach is referred to as <a href="http://venkateshabbarapu.blogspot.com/2013/03/edge-triggered-vs-level-triggered.html" rel="nofollow noreferrer">level-based, as oppo...
<p>I run a kubernetes cluster with cert-manager installed for managing ACME (Let's Encrypt) certificates. I'm using DNS domain validation with Route 53 and it works all fine.</p> <p>The problem comes when I try to issue a certificate for a cluster internal domain. In this case domain validation does not pass since the ...
<p>Assuming that you don't control public DNS for your cluster internal domain, you will not be able to receive LetsEncrypt certificates for it.</p> <p>You may however set up another issuer that will grant you certificates for this domain, e.g. the SelfSigned issuer: <a href="https://cert-manager.io/docs/configuration/...
<p>After upgrading the jenkins plugin Kubernetes Client to version 1.30.3 (also for 1.31.1) I get the following exceptions in the logs of jenkins when I start a build:</p> <pre><code>Timer task org.csanchez.jenkins.plugins.kubernetes.KubernetesClientProvider$UpdateConnectionCount@2c16d367 failed java.lang.NoSuchMethodE...
<p>Downgrade the plugin to kubernetes-client-api:5.10.1-171.vaa0774fb8c20. The latest one has the compatibility issue as of now.</p> <p><strong>new info</strong>: The issue is now solved with upgrading the <strong>Kubernetes plugin</strong> to version: 1.31.2 <a href="https://issues.jenkins.io/browse/JENKINS-67483" rel...
<p><a href="https://i.stack.imgur.com/gsuuu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gsuuu.png" alt="enter image description here" /></a></p> <p>I have this situation where I want to connect my postgres database that is running on a docker container, to the pgadmin web client running on a loca...
<p>Your minikube cluster is using a VM which is different from the VM that docker uses on windows/mac to provide the container runtime. That makes access quite tricky.</p> <p>But since your use case is to simulate a database outside of the cluster it serves quite well. You already exposed the docker port externally so ...
<p>I have an Elasticsearch DB running on Kubernetes exposed to <code>my_domain.com/elastic</code> as an Istio virtual service, which I have no problem accessing via the browser (as in I get to login successfully to the endpoint). I can also query the DB with Python's Requests. But I can't access the DB with the officia...
<p>I have reproduced your problem and the solution is as follows. First, pay attention to your yaml file:</p> <pre><code>apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: elastic-vts namespace: elastic-system spec: hosts: - &quot;mydomain.cloud&quot; gateways: - istio-system/gatew...
<p>I am trying to update a deployment via the YAML file, similar to <a href="https://stackoverflow.com/questions/48191853/how-to-update-a-deployment-via-editing-yml-file">this question</a>. I have the following yaml file...</p> <pre><code>apiVersion: apps/v1 kind: Deployment metadata: name: simple-server-deployment ...
<p>You can use <a href="https://stackoverflow.com/questions/61875309/what-does-record-do-in-kubernetes-deployment"><code>--record</code> flag</a> so in your case the command will look like:</p> <pre><code>kubectl apply -f simple-deployment.yml --record </code></pre> <p>However, a few notes.</p> <p>First, <a href="https...
<p>I have AWS EKS cluster with only Fargate profile, no Node Groups. Is it possible to enable HPA in this case? I tried to enable metric server as described <a href="https://docs.aws.amazon.com/eks/latest/userguide/metrics-server.html" rel="nofollow noreferrer">here</a> but pod creation fails with error</p> <pre><code>...
<p>You need to create fargate profile for this. If you are deploying it into another namespace then you need to create a fargate profile for that namespace.</p>
<p>I am trying to add a new key value pair to existing set of Annotations to a running Pod using the below example code:</p> <pre><code>import ( &quot;fmt&quot; &quot;context&quot; metav1 &quot;k8s.io/apimachinery/pkg/apis/meta/v1&quot; &quot;k8s.io/client-go/tools/clientcmd&quot; ...
<p>You're going to want something along the lines:</p> <pre class="lang-golang prettyprint-override"><code>... pod.SetAnnotations(annotations) client. CoreV1(). Pods(&quot;default&quot;). Update(context.TODO(), pod, metav1.UpdateOptions{}) </code></pre> <p>See: <a href="https://pkg.go.dev/k8s.io/client-go@v0.23.1...
<p>I have a spring cloud gateway that works fine in the docker configuration, like this: (all routes/services except ratings are removed for readability's sake)</p> <pre><code>@Value(&quot;${hosts.ratings}&quot;) private String ratingsPath; @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { ...
<p>Posting community wiki based on comment for better visibility. Feel free to expand it.</p> <hr /> <p>The issue was a faulty version of the image:</p> <blockquote> <p>It seems like the service i was using just straight up didn't work. Must have been a faulty version of the image i was using.</p> </blockquote> <p>Chec...
<p>I am preparing <code>dev</code> environment and want to create a single host to be master and worker node for kubernetes.</p> <p>How can I achieve my goal?</p>
<blockquote> <p>The <em><strong>master node</strong></em> is responsible for running several Kubernetes processes that are absolutely necessary to run and manage the cluster properly. <a href="https://www.educative.io/edpresso/what-is-kubernetes-cluster-what-are-worker-and-master-nodes" rel="nofollow noreferrer">[1]</a...
<p>I have 2 pods in a Kubernetes namespace. One uses <code>TCP</code> and the other uses <code>UDP</code> and both are exposed using <code>ClusterIP</code> services via external IP. Both services use the same external IP.</p> <p>This way I let my users access both the services using the same IP. I want to remove the u...
<p>Unfortunately, you will not be able to achieve your desired result with Load Balancer. Service type in any way for UDP traffic, because according the <a href="https://cloud.ibm.com/docs/containers?topic=containers-vpc-lbaas#lbaas_limitations" rel="nofollow noreferrer">following documentation</a> UDP protocol is not ...
<p>Creating a Pod with spec <code>terminationGracePeriodSeconds</code> specified, I can't check whether this spec has been applied successfully using <code>kubectl describe</code>. How can I check whether <code>terminationGracePeriodSeconds</code> option has been successfully applied? I'm running kubernetes version 1.1...
<p>Assuming the pod is running successfully. You should be able to see the settings in the manifest.</p> <p><strong>terminationGracePeriodSeconds</strong> is available in v1.19 as per the following page. Search for &quot;terminationGracePeriodSeconds&quot; here. <a href="https://kubernetes.io/docs/reference/generated/k...
<p>Hello I have a problem in kubernetes. When I do a nslookup from a pod I get correct ip:</p> <pre><code>~ kubectl -n exampleNamespace exec -it pod/curl -- nslookup exampleService.exampleNamespace Defaulting container name to curl. Use 'kubectl describe pod/curl -n exampleNamespace' to see all of the containers in thi...
<p>It seams that there are some problems with <code>Alpine</code> and <code>Kubernetes</code> dns resolution as reported at some sites:</p> <ul> <li><a href="https://www.openwall.com/lists/musl/2018/03/30/9" rel="nofollow noreferrer">https://www.openwall.com/lists/musl/2018/03/30/9</a></li> <li><a href="https://stackov...
<p>With:</p> <p><code>kubectl apply -f web.yaml --server-dry-run --validate=false -o yaml</code></p> <p>I get an error:</p> <pre><code>Error: unknown flag: --server-dry-run See 'kubectl apply --help' for usage. </code></pre> <p>And even with:</p> <p><code>kubectl apply -f web.yaml --dry-run=server --validate=false -o y...
<blockquote> <p>I get an error:</p> </blockquote> <pre class="lang-yaml prettyprint-override"><code>Error: unknown flag: --server-dry-run See 'kubectl apply --help' for usage. </code></pre> <p>That's correct. This flag is deprecated. You need to use <code>--dry-run=server</code> flag. For more look <a href="https://kub...
<p>The <a href="https://book.kubebuilder.io" rel="nofollow noreferrer">Kubebuilder V3 documentation</a> explains that it talks about &quot;How to batch multiple events into a single reconciliation call&quot;. However, I could not find any information about event management in this documentation.</p> <p>Could you please...
<p><a href="https://book-v1.book.kubebuilder.io/basics/simple_controller.html" rel="nofollow noreferrer">This part</a> from the official documentation should answer your question:</p> <blockquote> <p><strong>This business logic of the Controller is implemented in the <code>Reconcile</code> function. This function takes...
<h1>Context</h1> <p>We have a Spring Boot application, deployed into K8s cluster (with 2 instances) configured with Micrometer exporter for Prometheus and visualization in Grafana.</p> <h2>My custom metrics</h2> <p>I've implemented couple of additional Micrometer metrics, that report some information regarding business...
<p>In Prometheus, you can obtain the labels of the latest scrape using <code>topk()</code> and <code>timestamp()</code> function:</p> <pre><code>topk(1,timestamp(up{job=&quot;micrometer&quot;})) </code></pre> <p>This can then be used in Grafana to populate a (hidden) variable containing the instance name:</p> <pre><cod...
<p>I have some trouble in understanding why I get multiple results for the same pod in Prometheus/Grafana.</p> <p>I'm trying to get cpu usage through <code>rate(container_cpu_usage_seconds_total{namespace=~&quot;.+-test&quot;, pod=~&quot;my-server-.+&quot;, image!~&quot;|.*pause.*&quot;, container!=&quot;POD&quot;}[5m]...
<p>Try this query:</p> <pre><code>rate(container_cpu_usage_seconds_total{container!=&quot;POD&quot;, container=~&quot;.+&quot;}[5m]) </code></pre> <p>In short, CPU usage is available at several resolutions (container, pod, <a href="https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/#qos-classe...
<p>In my case I have not added any parameter for backofflimit in kind:job so job will retry for 6 times and if it is completed it will remove all pods Error and Completed as used hook delete policy.</p> <pre><code>apiVersion: batch/v1 kind: Job metadata: name: create-job annotations: &quot;helm.sh/hook&quot;: &...
<p>Your failed pod should be automatically deleted once hitting backofflimit (default to 6) if your restartPolicy is defined as onFailure.</p> <p>In my case - cronjob defined and should run every 15mins: <a href="https://i.stack.imgur.com/h0aj7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h0aj7.pn...
<p>I have a Custom Resource Definition which has nested fields with default values (some boilerplate omitted for brevity):</p> <pre class="lang-yaml prettyprint-override"><code>apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition spec: scope: Namespaced group: thismatters.stackoverflow names: ki...
<p>Adding a <code>default</code> property to the <code>shouldDefault</code> object fixes this:</p> <pre class="lang-yaml prettyprint-override"><code>apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition spec: scope: Namespaced group: thismatters.stackoverflow names: kind: BadDefault versions: ...
<p>Here is the output when checking the detail of a specific cluster role. what do Non-Resource URLs and Resource Names mean in the result?</p> <pre><code>controlplane ~ kubectl describe clusterrole node-admin Name: node-admin Labels: &lt;none&gt; Annotations: &lt;none&gt; PolicyRule: Resources Non-R...
<p>From the <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#policyrule-v1-rbac-authorization-k8s-io" rel="nofollow noreferrer">API docs</a></p> <blockquote> <p><strong>NonResourceURLs</strong> is a set of partial urls that a user should have access to. *s are allowed, but only as the full,...
<p>I am using Spark <code>3.1.2</code> and have created a cluster with 4 executors each with 15 cores.</p> <p>My total number of partitions therefore should be 60, yet only 30 are assigned.</p> <p>The job starts as follows, requesting 4 executors</p> <pre><code>21/12/23 23:51:11 DEBUG ExecutorPodsAllocator: Set total e...
<p>Per <a href="https://spark.apache.org/docs/latest/configuration.html#scheduling" rel="nofollow noreferrer">Spark docs</a>, scheduling is controlled by these settings</p> <blockquote> <p><code>spark.scheduler.maxRegisteredResourcesWaitingTime</code><br>default=30s<br> Maximum amount of time to wait for resources to r...
<p>I have a hard time understand how exactly is the Istio Gateway port used. I am referring to line 14 in the below example</p> <pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: gateway spec: selector: istio: ingressgateway servers: - ...
<p>You encountered an interesting aspect of Istio - how to configure Istio to expose a service outside of the service mesh using an Istio Gateway.</p> <p>First of all, please note that the gateway configuration will be applied to the proxy running on a Pod (in your example on a Pod with labels <code>istio: ingressgate...
<p>We are consuming kubelet <code>/stats/summary</code> endpoint.</p> <p>We noticed that the metrics returned are not always present and might be missing in some scenarios.</p> <p>In particular we are interested in <code>Rootfs.UsedBytes</code> that in missing in <code>minikube</code> but present in other environments....
<p>To clarify I am posing community wiki answer.</p> <p>The problem here was resolved by changing driver to <em><strong>Hyperkit</strong></em>.</p> <p>According to the <a href="https://minikube.sigs.k8s.io/docs/drivers/hyperkit/" rel="nofollow noreferrer">documentation</a>:</p> <blockquote> <p><a href="https://github.c...
<p>Im integrating keycloak OAuth login to Grafana in Openshift.</p> <pre><code>Keycloak Image Version - quay.io/keycloak/keycloak:15.0.2 Grafana Image Version - grafana/grafana:7.1.5 Kubernetes Version - v1.21 Openshift Version - 4.8 </code></pre> <p>The keyclaok is exposed at Route: <code>http://keycloak-keycloak.rou...
<p>It is in the <a href="https://grafana.com/docs/grafana/latest/auth/generic-oauth/" rel="nofollow noreferrer">Grafana documentation</a>:</p> <blockquote> <p>You may have to set the root_url option of [server] for the callback URL to be correct.</p> </blockquote> <p>So remove <code>GF_SERVER_DOMAIN,GF_SERVER_HTTP_PORT...
<p>I'm doing a lab and can't understand this:</p> <blockquote> <p>Kubectl has support for auto-completion allowing you to discover the available options. This is applied to the current terminal session with source &lt;(kubectl completion bash)</p> </blockquote> <p>The cmd:</p> <pre><code>source &lt;(kubectl completion ...
<ul> <li><code>source</code> (synonym for <code>.</code>) is a bash built in command which executes the given file in the current shell environment</li> <li><code>&lt;(command ...)</code> is process substitution - the output of the commands are passed as a file</li> <li>bash completion is implemented with shell functio...
<p>Both replica set and deployment have the attribute <code>replica: 3</code>, what's the difference between deployment and replica set? Does deployment work via replica set under the hood?</p> <p>configuration of deployment</p> <pre><code>apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment labels: ...
<p>Deployment resource makes it easier for updating your pods to a newer version.</p> <p>Lets say you use <em>ReplicaSet-A</em> for controlling your pods, then You wish to update your pods to a newer version, now you should create <em>Replicaset-B</em>, scale down <em>ReplicaSet-A</em> and scale up <em>ReplicaSet-B</em...
<p>I use the vanilla Open Policy Agent as a deployment on Kubernetes for handling admission webhooks.</p> <p>The behavior of multiple policies evaluation is not clear to me, see this example:</p> <pre><code>## policy-1.rego package kubernetes.admission check_namespace { # evaluate to true namespaces := {&quot;n...
<p><em>Files</em> don't really mean anything to OPA, but packages do. Since both of your policies are defined in the <code>kubernetes.admission</code> module, they'll essentially be appended together as one. This works in your case only due to one of the <code>check_user</code> and <code>check_namespace</code> respecti...
<p>I am trying to understand the VirtualService and DestinationRule resources in relation with the namespace which should be defined and if they are really namespaced resources or they can be considered as cluster-wide resources also.</p> <p>I have the following scenario:</p> <ul> <li>The frontend service (web-frontend...
<p>A DestinationRule to actually be applied during a request needs to be on the destination rule lookup path:</p> <pre><code>-&gt; client namespace -&gt; service namespace -&gt; the configured meshconfig.rootNamespace namespace (istio-system by default) </code></pre> <p>In your example, the &quot;web-frontend&quot; cli...
<p>In my POD, I wanted to restrict ALL my containers to read-only file systems with <em><strong>securityContext: readOnlyRootFilesystem: true</strong></em><br /> example (note: yaml reduced for brevity)</p> <pre><code>apiVersion: v1 kind: Pod metadata: labels: run: server123 name: server123 spec: securi...
<p>In Kubernetes, can configure <em><strong>securityContext</strong></em> at pod and/or container level, containers would inherit pod-level settings, but can override in their own.</p> <p>The configuration options for pods and containers do not, however, overlap - you can only set specific ones at each level,<br /> Con...
<p>I am trying to get my deployment to only deploy replicas to nodes that aren't running rabbitmq (this is working) and also doesn't already have the pod I am deploying (not working).</p> <p>I can't seem to get this to work. For example, if I have 3 nodes (2 with label of app.kubernetes.io/part-of=rabbitmq) then all 2 ...
<p>I think Thats because of the <code>matchExpressions</code> part of your manifest , where it requires pods need to have both the labels <code>app.kubernetes.io/part-of: rabbitmq</code> <strong>and</strong> <code>app: testscraper</code> to satisfy the antiaffinity rule.</p> <p>Based on deployment yaml you have provi...
<p>I have a Kubernetes cluster that is running a Jenkins Pod with a service set up for Metallb. Currently when I try to hit the <code>loadBalancerIP</code> for the pod outside of my cluster I am unable to. I also have a <code>kube-verify</code> pod that is running on the cluster with a service that is also using Metall...
<p>MetalLB doesn't allow by default to re-use/share the same LoadBalancerIP addresscase.</p> <p>According to <a href="https://metallb.universe.tf/usage/" rel="nofollow noreferrer">MetalLB documentation</a>:</p> <blockquote> <p>MetalLB respects the <code>spec.loadBalancerIP</code> parameter, so if you want your service ...
<p>I am creating a POD file with multiple containers. One is a webserver container and another is my PostgreSQL container. Here is my pod file named <code>simple.yaml</code></p> <pre><code>apiVersion: v1 kind: Pod metadata: creationTimestamp: &quot;2022-01-01T16:28:15Z&quot; labels: app: eltask name: eltask s...
<p>For your web container to connect to the postgresql container within the pod, use <code>ELTASK_DATABASE_PORT=5432</code> instead of ELTASK_DATABASE_PORT=9876.</p>
<p>We are implementing encryption at rest in Kubernetes by this tutorial (<a href="https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/</a>) and we are absolutely not sure why AES-GCM encryption provider requires t...
<blockquote> <p>we are absolutely not sure why AES-GCM encryption provider requires to rotate</p> </blockquote> <p>The GCM mode is basically a <a href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation" rel="nofollow noreferrer">CTR streaming mode</a> with built-in integrity validation (message authenticatio...
<p>From time to time we find that some logs are missing in the ES, while we are able to see them in Kubernetes.</p> <p>Only problems in logs I was able to find, point out to a problem with the kubernetes parser with things like these in the fluent-bit logs: <code>[2020/11/22 09:53:18] [debug] [filter:kubernetes:kuberne...
<hr /> <ol> <li>May be I'm missing smth, but I can't find any output for <code>kube.*</code></li> </ol> <hr /> <ol start="2"> <li></li> </ol> <p>I've got same error and after enabling</p> <pre><code>[OUTPUT] .... Trace_Error on </code></pre> <p>Elastic returns to Fluentbit conflict in fields mapping.</p> <pre><code...
<p>My question is the same of this question: <a href="https://stackoverflow.com/questions/55159582/k8s-python-how-do-i-read-a-secret-using-the-kubernetes-python-client">k8s/python: How do I read a secret using the Kubernetes Python client?</a> but from inside Kubernetes. I know how to access secrets from the outside wi...
<p>I think your guess is right, and that if you deploy a pod with the <a href="https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#define-a-container-environment-variable-with-data-from-a-single-secret" rel="nofollow noreferrer">following configuration</a>, then you will be able to a...
<p>Not sure if this is OS specific, but on my M1 Mac, I'm installing the Nginx controller and resource example located in the official <a href="https://kubernetes.github.io/ingress-nginx/deploy/#quick-start" rel="nofollow noreferrer">Quick Start guide for the controller.</a> for Docker Desktop for Mac. The instructions...
<p>I replicated your issue and got a similar behaviour on the Ubuntu 20.04.3 OS.</p> <p>The problem is that <a href="https://kubernetes.github.io/ingress-nginx/deploy/#local-testing" rel="noreferrer">NGINX Ingress controller Local testing guide</a> did not mention that <a href="https://mxtoolbox.com/SuperTool.aspx?acti...
<p>I'm managing a small Kubernetes cluster on Azure with Postgres. This cluster is accessible through an Nginx controller with a static IP.</p> <p>The ingress routes to a ClusterIP to a pod which uses a Postgres instance. This Postgres instance has all IPs blocked, with a few exceptions for my own IP and the static IP ...
<p><code>Ingresses</code> and <code>Services</code> handle only incoming pod traffic. Pod outgoing traffic IP depends on Kubernetes networking implementation you use. By default all outgoing connections from pods are source NAT-ed on node level which means pod will have an IP of node which it runs on. So you might want...
<p>I'm currently testing out google cloud for a home project. I only require the node to run between a certain time slot. When I switch the node off it automatically switches itself on again. Not sure if I am missing something as I did not enabling autoscaling and it's also a General Purpose e2-small instance</p>
<blockquote> <p>When I switch the node off it automatically switches itself on again. Not sure if I am missing something as I did not enabling autoscaling and it's also a General Purpose e2-small instances</p> </blockquote> <p>Kubernetes nodes are managed by the Node pool. Which you might created during your cluster cr...
<p>I am following Linode's tutorials on using helm to deploy to Linode Kubernetes Engine (LKE) and I have reached <a href="https://youtu.be/wLHegOz_aR4?t=661" rel="nofollow noreferrer">the section on configuring external DNS</a> which uses <a href="https://artifacthub.io/packages/helm/bitnami/external-dns" rel="nofollo...
<p>It appears this is due to <em>external-dns</em> applying some logic which <a href="https://github.com/kubernetes-sigs/external-dns/blob/master/docs/faq.md#can-i-force-externaldns-to-create-cname-records-for-elbalb" rel="nofollow noreferrer">detects if the target is an Elastic Load Balancer</a>.</p> <p>After creating...
<p>First of all: I readed other posts like <a href="https://stackoverflow.com/questions/51946393/kubernetes-pod-warning-1-nodes-had-volume-node-affinity-conflict">this</a>.</p> <p>My staging cluster is allocated on AWS using <strong>spot instances</strong>.</p> <p>I have arround 50+ pods (runing diferent services / pro...
<p>First of all, it's better to move <code>allowedTopologies</code> stanza to <code>StorageClass</code>. It's more flexible because you can create multiple zone-specific storage classes.</p> <p>And yes, this should obviously solve your one problem and create another. You basically want to sacrifice high availability to...
<p>I am creating a POD file with multiple containers. One is a webserver container and another is my PostgreSQL container. Here is my pod file named <code>simple.yaml</code></p> <pre><code>apiVersion: v1 kind: Pod metadata: creationTimestamp: &quot;2022-01-01T16:28:15Z&quot; labels: app: eltask name: eltask s...
<p>Posting this as a community wiki, feel free to edit and expand.</p> <hr /> <p>There are two parts of the answer:</p> <ol> <li><strong>Which port to use and why</strong></li> </ol> <p>For <code>postgresql</code> as a backend service, you can omit the <code>hostPort</code> since <code>podman</code> as a frontend servi...
<p>I'm trying to run/set up ingress in Minikube. But it is not happening. Here are the steps Environment:</p> <ul> <li>Windows 10 professional</li> <li>minikube version: v1.24.0</li> </ul> <br> <p><strong>Ingress enabled:</strong></p> <p>| ingress | minikube | enabled βœ… | unknown (third-party) | <...
<p>You can get your minikube cluster ip with below and proceed.</p> <p>minikube ip</p> <p>Add this ip to /etc/hosts</p>
<p>I use a private online server to set a jenkins environment though kubernetes.</p> <p>I have the following service file:</p> <pre><code>apiVersion: v1 kind: Service metadata: name: jenkins namespace: jenkins spec: type: NodePort ports: - port: 8080 targetPort: 8080 selector: app: jenkins </code></...
<p>Configuration you provided should be fine, but you would have to configure additional firewall rules on the nodes to make it possible to connect to your Jenkins Service on <code>NodeIP:NodePort</code> externally.</p> <p>There are certain <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/" rel="nof...
<p>Say I have 100 running pods with an HPA set to <code>min=100</code>, <code>max=150</code>. Then I change the HPA to <code>min=50</code>, <code>max=105</code> (e.g. max is still above current pod count). Should k8s immediately initialize new pods when I change the HPA? I wouldn't think it does, but I seem to have obs...
<p>First, as mentioned in the comments, in your specific case some pods will be terminated if usage metrics are below utilization target, no new pods will be created.</p> <p>Second thing it's absolutely normal that is takes some time to scale down replicas - <a href="https://kubernetes.io/docs/tasks/run-application/hor...
<p>I deleted my cluster-admin role via kubectl using:</p> <p><code>kubectl delete clusterrole cluster-admin</code></p> <p>Not sure what I expected, but now I don't have access to the cluster from my account. Any attempt to get or change resources using kubectl returns a 403, Forbidden. Is there anything I can do to rev...
<blockquote> <p>Not sure what I expected, but now I don't have access to the cluster from my account.</p> </blockquote> <p>If none of the <code>kubectl</code> commands actually work, unfortunately you will not be able to create a new cluster role. The problem is that you won't be able to do anything without an admin ro...
<p>I recently got started with building a <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/" rel="noreferrer">Kubernetes operator</a>. I'm using the <a href="https://github.com/fabric8io/kubernetes-client" rel="noreferrer">Fabric8 Java Kubernetes Client</a> but I think my question is more general...
<p>You should use both.</p> <p>When using informers, it's possible that the handler gets the events out of order or even not at all. The former means the handler needs to define and reconcile state - this approach is referred to as <a href="http://venkateshabbarapu.blogspot.com/2013/03/edge-triggered-vs-level-triggered...
<p>I've got a database running in a private network (say IP 1.2.3.4).</p> <p>In my own computer, I can do these steps in order to access the database:</p> <ul> <li>Start a Docker container using something like <code>docker run --privileged --sysctl net.ipv4.ip_forward=1 ...</code></li> <li>Get the container IP</li> <li...
<p><code>I wonder if there's a way to route traffic through a specific pod in Kubernetes for certain IPs in order to achieve the same results. We use GKE, by the way, I don't know if this helps in any way.</code></p> <p>You can start a GKE in a fully private network like <a href="https://cloud.google.com/kubernetes-eng...
<p>According to the K8s <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#stabilization-window" rel="noreferrer">documentation</a>, to avoid flapping of replicas property <code>stabilizationWindowSeconds</code> can be used</p> <blockquote> <p>The stabilization window is used to restric...
<p>There is a bug in k8s HPA in v1.20, check the <a href="https://github.com/kubernetes/kubernetes/issues/96671" rel="noreferrer">issue</a>. Upgrading to v1.21 fixed the problem, deployment is scaling without flapping after the upgrade.</p> <p>On the picture scaling of the deployment over 2 days:</p> <p><a href="https:...
<p>I have a CronJob which runs every 10 minutes and executes some command.</p> <p>It's failing for some reason and I want to <code>exec</code> into it to investigate and fix it (There's a 1 time command I need to run to fix a shared volume*).</p> <p>The issue is when I try to run <code>exec</code> I get this error, whi...
<p>Looked into this question more, your <strong>option 2 is the most viable solution</strong>.</p> <p>Adding a sidecar container - it's the same as option 1, but even more difficult/time consuming.</p> <p>As mentioned in comments, there are no options for direct imperative pod creation from <code>job</code>/<code>cronj...
<p>I am reading the documentation for using kubeadm to set up a Kubernetes cluster. I am running Ubuntu Server 20.04 on three VMs but am currently only working with one of them before doing the configuration on the other two. I have prepared containerd and disabled swap, but am getting stuck with enabling the required ...
<ul> <li><p>Thats because there is no process listening on 6443.you can verify it using <code>ss -nltp | grep 6443 </code></p> </li> <li><p>6443 will be listened by &quot;kube-apiserver&quot; which gets created after you initialize the cluster using <code> kubeadm init --apiserver-advertise-address=192.168.50.55 --pod-...
<p>Whenever I am trying to run the docker images, it is exiting in immediately.</p> <pre><code>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ae327a2bdba3 k8s-for-beginners:v0.0.1 &quot;/k8s-for-beginners&quot; 11 seconds ago Exited ...
<p>In my particular case, this exact error was caused by a Bash entry script with incorrect Windows/DOS line endings.</p> <p>Add this to the Docker file:</p> <pre><code>RUN dos2unix /entrypoint.sh </code></pre> <p>If <code>dos2unix</code> is not installed, prefix with:</p> <pre><code># For Alpine Linux: RUN apk add dos...
<p>I am trying to secure a 3rd party application within our EKS cluster using Istio and Azure AD.</p> <p>My configuration works on a local docker-desktop K8S cluster but when deployed to our EKS it seems that the token is never passed to the istio-proxy on the application's pod and thus never authorizes.</p> <p>Given m...
<p>I was able to resolve this by adding the following to my AuthorizationPolicy:</p> <pre><code> rules: - from: - source: requestPrincipals: [&quot;$ISS/$SUB&quot;] </code></pre>
<p>I am currently trying to move my calico based clusters to the new Dataplane V2, which is basically a managed Cilium offering. For local testing, I am running k3d with open source cilium installed, and created a set of NetworkPolicies (k8s native ones, not CiliumPolicies), which lock down the desired namespaces.</p> ...
<p>Update: I was able to solve the mystery and it was ArgoCD all along. Cilium is creating an Endpoint and Identity for each object in the namespace, and Argo was deleting them after deploying the applications.</p> <p>For anyone who stumbles on this, the solution is to add this exclusion to ArgoCD:</p> <pre class="lang...
<p>I'm trying to setup Spring cloud gateway on openshift and want to discover the services available within cluster. I'm able to discover the services by adding the @DiscoveryClient and dependencies as below.</p> <p>Boot dependencies are like:</p> <pre><code> spring-cloud.version : Greenwich.SR2 spring-boot-star...
<p>I'm able to resolve this error by using k8s discovery with url-expression as below:</p> <pre><code>spring: cloud: gateway: discovery: locator: enabled: true lower-case-service-id: true url-expression: &quot;'https://'+serviceId+':'+getPort()&quot; </code></pre> <p>Ro...
<p>We have followed <a href="https://mainflux.readthedocs.io/en/latest/kubernetes/" rel="nofollow noreferrer">this</a> tutorial to get mainflux up and running. After installing kubectl we added helm repos as follows</p> <pre><code>helm repo add stable https://charts.helm.sh/stable helm repo add bitnami https://charts.b...
<p>In this case problem was the lack of the <strong>Ingressclass</strong>.</p> <p>To solve this problem:</p> <pre class="lang-sh prettyprint-override"><code>&quot;Ignoring ingress because of error while validating ingress class&quot; ingress=&quot;mf/mainflux-nginx-ingress&quot; error=&quot;ingress does not contain a v...
<p>I'm trying to learn Kubernetes. One thing I don't understand is the following scenario:</p> <p>Given I have a pod with 2 containers. One container runs an app listening on port 80, the other container is a sidecar which does some polling from a web resource but doesn't listen on any port.</p> <p>Now when I start a s...
<p>The Kubernetes overview documentation of <a href="https://kubernetes.io/docs/concepts/workloads/pods/#pod-networking" rel="nofollow noreferrer">Pods</a> notes:</p> <blockquote> <p>Every container in a Pod shares the network namespace.... Within a Pod, containers share an IP address and port space....</p> </blockquo...