prompt stringlengths 65 38.7k | response stringlengths 41 29.1k |
|---|---|
<p>I am tasked with building a new relic chart to show gitlab runner job count over time.
I am trying to determine what type of object is a gitlab runner job. Is is a deployment, a pod or a statefulset?</p>
<p>Any assistance with being able to visualize gitlab runner pods in new relic would be appreciated.</p>
| <p>As mentioned in "<a href="https://docs.gitlab.com/runner/executors/kubernetes.html" rel="nofollow noreferrer">Kubernetes executor for GitLab Runner</a>":</p>
<blockquote>
<p>The Kubernetes executor, when used with GitLab CI, connects to the Kubernetes API in the cluster creating <strong>a Pod for each GitL... |
<p>I have installed Prometheus-adapter along with the default metrics-server that comes with k3s securely on port 443.</p>
<p>Unfortunately, I get no resources when I query custom.metrics.k8s.io</p>
<pre><code>$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1" | jq .
{
"kind": "APIRes... | <p>To solve this issue, I had to create <a href="https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/" rel="nofollow noreferrer">separate certificate</a> for both metrics-server and adapter. Adapter also has an <a href="https://github.com/kubernetes-sigs/prometheus-adapter/issues/169" rel="nofollow noreferre... |
<p>I have an Apple Macbook Pro with an M1 chip, where I have a local kubernetes cluster running through <code>Kind</code>. The thing is I don't understand how <code>Kind</code> deals with docker images from different platforms/architectures. The thing is I have an application installed via <code>Helm</code> that points... | <p>After asking in the <a href="https://kubernetes.slack.com/archives/CEKK1KTN2" rel="nofollow noreferrer">Kind Slack channel in the Kubernetes workspace</a> I could finally find the answer to my question: <a href="https://kubernetes.slack.com/archives/CEKK1KTN2/p1665033551816149" rel="nofollow noreferrer">whole thread... |
<p>I am looking for the python Kubernetes client equivalent for</p>
<pre><code>kubectl get deploy -n app -l team=blue
</code></pre>
<p>I'm aware of this function <code>deployment = api.read_namespaced_deployment(name='foo', namespace='bar')</code> but how can I have same thing with label?</p>
| <p><code>read_namespaced_deployment</code> expects deployment name, which does not make sense of using <code>label</code>, you should use <a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/AppsV1Api.md#list_namespaced_deployment" rel="nofollow noreferrer">list_namespaced_deployment</a></p>... |
<p>Forgive me for asking a stupid question but I can't seem to find anywhere in the Kubernetes API reference how to query logs via the REST API if there's more than one container running inside the pod?</p>
<p><code>cURL -k -H Authorization: Bearer my-super-secret-token https://kubernetes/api/v1/namespaces/default/pods... | <p>Figured it out - I needed to add <strong>container</strong> using a query parameter:</p>
<p><em>?container=nginx</em></p>
<p><strong>Working Example:</strong></p>
<p><code>cURL -k -H Authorization: Bearer my-super-secret-token https://kubernetes/api/v1/namespaces/default/pods/my-app-1/log?container=nginx</code></p>
|
<p>I was wondering if it was really relevant to set “requests” (CPU/MEM) values if I’m not using HPA ?</p>
<p>If those values are not used to scale up or down some pods, what is the point ?</p>
| <p>It's fine and it will work if you don't provide the <strong>requests</strong> (CPU/MEM) to workloads.</p>
<p>But consider the scenario, suppose you have 1-2 Nodes with a capacity of <strong>1</strong> <strong>GB</strong> and you have not mentioned the <strong>requests</strong>.</p>
<p>Already running application uti... |
<p>I have a .NET Core Web API hosted in Kubernetes as a Pod. It is also exposed as a Service.
I have created a Dev SSL certificate and it's produced a aspnetapp.pfx file.</p>
<p>Here is a snippet of my Docker file:</p>
<pre><code>FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 443
ENV ASPNETCORE_UR... | <p>I just ran into this same problem and even though things were working fine previously, <em>something</em> was updated (possibly .NET 6.0.402) which caused a problem.</p>
<p>What I noticed is that my exported dev cert pfx in the Docker container had it's permissions set to:</p>
<pre><code>-rw------- 1 root root ... |
<p>i want to access dotted named value with helm to use in ConfigMap
the value is something like that</p>
<pre><code>valuenum:
joji.json: zok
</code></pre>
<p>i want to use it in ConfigMap with helm as this</p>
<pre><code>{{ toYaml .Values.valuenum.joji.json }}
</code></pre>
<p>it returns syntax error.
could not find... | <p>I found the answer myself, when using index we can search for nested variables with quotes.</p>
<pre><code>{{ index .Values.valuenum "joji.json" }}
</code></pre>
<p><a href="https://helm.sh/docs/chart_template_guide/variables/" rel="nofollow noreferrer">link for helm doc about index and more</a></p>
|
<p>I'm developing a kubernetes operator that represents a very simple api and a controller.
I would like to maximize the number of the CustomResources those could belonging to the specific CustomResourceDefinition that the operator defines. (As specially I would like to allow just one CR, if it is already defined, the ... | <p>Assuming you are using the default <code>sigs.k8s.io/controller-runtime/pkg/client</code>'s <code>client.Client</code>, you get access to the <code>List()</code> function.</p>
<p>In your case <code>r.List(...)</code>.</p>
<h2>Usage:</h2>
<h3>case 1: list by label</h3>
<pre class="lang-golang prettyprint-override"><c... |
<p>My asp.net core web application has redirection applied on statup.cs as:</p>
<pre><code>app.UseHttpsRedirection();
</code></pre>
<p>The problem arises when I host it on kubernetes where this redirection does not happens. The app opens on both http and https url.</p>
<p><strong>I am hosting the app on local kubernete... | <p>According to my research I found the following way.</p>
<ol>
<li>Remove the redirection from an ASP.NET Core app when we host it to kubernetes.</li>
<li>Apply the redirect to Ingress itself. By adding the following 2 lines to it:</li>
</ol>
<blockquote>
<p>nginx.ingress.kubernetes.io/force-ssl-redirect: "true&q... |
<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><a href="https://docs.fluentbit.io/manual/pipeline/filters/kubernetes" rel="nofollow noreferrer">https://docs.fluentbit.io/manual/pipeline/filters/kubernetes</a></p>
<pre><code> filters: |
[FILTER]
Name kubernetes
Match kube.*
Kube_URL https://kubernetes.default:443
tl... |
<p>I'm using Hashicorp Vault in Kubernetes. I'm trying to mount secret file into main folder where my application resides. It would look like that: <code>/usr/share/nginx/html/.env</code> while application files are in <code>/usr/share/nginx/html</code>. But the container is not starting because of that. I suspect that... | <p>I tried to replicate the use case, but I got an error</p>
<pre><code>2022/10/21 06:42:12 [error] 29#29: *9 directory index of "/usr/share/nginx/html/" is forbidden, client: 20.1.48.169, server: localhost, request: "GET / HTTP/1.1", host: "20.1.55.62:80"
</code></pre>
<p>so it seems like... |
<p>The Keycloak operator uses Quarkus: <a href="https://github.com/keycloak/keycloak/tree/main/operator" rel="nofollow noreferrer">https://github.com/keycloak/keycloak/tree/main/operator</a></p>
<p>In <code>application.properties</code> (<a href="https://github.com/keycloak/keycloak/blob/main/operator/src/main/resource... | <p>You should use the <code>unsupported</code> resource property. For instance:</p>
<pre><code>apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
...
spec:
unsupported:
podTemplate:
spec:
containers:
- name: keycloak
env:
- name: PROXY_ADDRESS_FORWARD... |
<p>Using CRD of SeldonDeployment I want to configure HPA following this <a href="https://docs.seldon.io/projects/seldon-core/en/latest/examples/autoscaling_example.html" rel="nofollow noreferrer">example</a>
. The seldon deployment config is -</p>
<pre><code>apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployme... | <p>I don't think that's a seldon-specific question.</p>
<p>I think you should define 3 charts like this for QA, Alpha and Prod. Each chart should have different values, and that's it!</p>
<p>Another thing is that this solution would duplicates the code - your static chart would be copied 3 times with just HPA params ch... |
<p>Basically, I have a problem deleting my <code>spoc-volume-spoc-ihm-kube-test</code> PVC I tried with:</p>
<pre><code>kubectl delete -f file.yml
kubectl delete PVC
</code></pre>
<p>but I get every time the same Terminating Status. Also, when I delete the PVC the console is stuck in the deleting process.</p>
<p>Capaci... | <p>You need to first check if the volume is attached to a resource using <code>kubectl get volume attachment</code>. If your volume is in the list, it means you have a resource i.e a pod or deployment that is attached to that volume. The reason why its not terminating is because the PVC and PV metadata <code>finalizers... |
<p>I am trying to make GRPC work in a <code>digitalocean</code> <code>Kubernetes</code> cluster - but am still to succeed.</p>
<blockquote>
<p>PS: Apologies for the long content</p>
</blockquote>
<p>I have found some content regarding this but those revolve around some ingress. For me, these are internal services.</p>
... | <p>Your interceptor usage is likely preventing execution of the RPC.</p>
<pre><code>// When a unary interceptor(s) is set on a ClientConn, gRPC
// delegates all unary RPC invocations to the interceptor, and it is the
// responsibility of the interceptor to call invoker to complete the processing
// of the RPC.
</code><... |
<p>Is it possible to apply <code>restartPolicy</code> for the pod based on docker exit code? What I mean is that if a container will exit with code 1 then the pod should be restarted (restartPolicy = Always), but when container will exit with code 2 then pod shouldn't be restarted (restartPolicy = Never)?</p>
<p>I have... | <p>It is possible from Kubernetes 1.25: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#pod-failure-policy" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/job/#pod-failure-policy</a></p>
<p>It only exists for Kubernetes jobs.</p>
<p>In the case of your initia... |
<p>Let's say we are running some services in a Kubernetes cluster and one of them requires a PostgreSQL instance, expected to persist data reliably. Should the DB live in the cluster or be configured separately?</p>
<p>Imagine that the DB is deployed in the cluster. This probably means one of the following:</p>
<ol>
<l... | <p>This is not an anti-pattern. It is just difficult to implement and manage.</p>
<p><strong>Point 1</strong></p>
<ul>
<li>In a self hosted cluster also you can have persistent volume storage provisioned though GlusterFS and CEPH. So, you don't always have to use ephemeral storage. So, Point 1 is not fully valid.</li>
... |
<p>A way to get the schema using as an example <code>secretproviderclasses.secrets-store.csi.x-k8s.io</code> i would use the command <code>kubectl describe crd secretproviderclasses.secrets-store.csi.x-k8s.io</code> and get as a result:</p>
<pre><code>Name: secretproviderclasses.secrets-store.csi.x-k8s.io
Names... | <p>I am not aware of something what returns you an example directly. But you could use <code>kubectl explain</code> to get information about the fields of the api-resources schema:</p>
<p>e.g.</p>
<pre><code>$ kubectl explain secretproviderclasses.secrets-store.csi.x-k8s.io
</code></pre>
<p>To get the fields listed in ... |
<p>I have read <a href="https://stackoverflow.com/questions/55965342/kubernetes-load-balancing">this question</a> which is very similar to what I am asking, but still wanted to write a new question since the accepted answer there seems very incomplete and also potentially wrong.</p>
<p>Basically, it seems like there is... | <p>A standard Kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">Service</a> provides basic load-balancing. Even for a ClusterIP-type Service, the Service has its own cluster-internal IP address and DNS name, and forwards requests to the collection of Pods s... |
<p>Currently, my Kubernetes cluster is provisioned via <code>GKE</code>.</p>
<p>I use <code>GCE Persistent Disks</code> to persist my data.</p>
<p>In <code>GCE</code>, persistent storage is provided via <code>GCE Persistent Disks</code>. Kubernetes supports adding them to <code>Pods</code> or <code>PersistenVolumes</co... | <p>You cannot have cloud agnostic storage by using the CSI drivers or the native VolumeClaims in Kubernetes. That's because these API's are the upstream way of provisioning storage which each cloud provider has to integrate with to translate them into the Cloud Specific API (PD for Google, EBS for AWS...)</p>
<p>Unless... |
<p>Auto scaler failing with the below error.</p>
<p>Procedure followed for <a href="https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler" rel="nofollow noreferrer">here</a></p>
<pre><code>aws_cloud_provider.go:369] Failed to generate AWS EC2 Instance Types: WebIdentityErr: failed to retrieve credenti... | <p>Add <code>"ec2:DescribeInstanceTypes"</code> permission to your <code><AmazonEKSClusterAutoscalerPolicy></code> IAM policy.
Then restart the Autoscaller deployment.</p>
<pre><code>kubectl -n kube-system rollout restart deployment.apps/cluster-autoscaler
</code></pre>
<p>This worked for me.</p>
|
<p>I am able to exec into a pod , and in that pod i will also like to run a stolonctl command at the same time into the pod i just exec into. Here is an example of what i will like to achieve. I tried using the first command first and then tried to see if i write the second command if it will work based on the first bu... | <p>You don't need to open a bash in the container first. You can run the <code>stolonctl</code> command directly:</p>
<pre><code>$ kubectl exec -it pod -c container ${cluster_name} -- stolonctl --cluster-name [cluster_name] --store-backend [store_backend] --store-endpoints kubernetes status
</code></pre>
|
<p>I'm trying to use the <a href="https://github.com/kubernetes/client-go" rel="nofollow noreferrer">K8S Go client</a> to list the <code>ClusterServiceVersion</code>s.
It could be enough to have the raw response body.</p>
<p>I've tried this:</p>
<pre class="lang-golang prettyprint-override"><code>data, err := clientset... | <p>It is possible to do a raw request using the <code>AbsPath()</code> method.</p>
<pre class="lang-golang prettyprint-override"><code>path := fmt.Sprintf("/apis/operators.coreos.com/v1alpha1/namespaces/%s/clusterserviceversions", namespace)
data, err := clientset.RESTClient().Get().
AbsPath(path).
D... |
<p>I want to make a <code>YAML</code> file with Deployment, Ingress, and Service (maybe with clusterissuer, issuer and cert) on one file, how can I do that? I tried</p>
<pre><code>kubectl apply -f (name_file.yaml)
</code></pre>
| <p>You can it with three dashes on your yaml file
like this</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
name: mock
spec:
...
---
apiVersion: v1
kind: ReplicationController
metadata:
name: mock
spec:
</code></pre>
<p>Source : <a href="https://levelup.gitconnected.com/kubernetes-merge-multiple-yaml-into-one... |
<p>I have the following setup in a kubernetes cluster:</p>
<pre><code>Node Name Node Label
worker-zone-a-1 topology.kubernetes.io/zone=a
worker-zone-a-2 topology.kubernetes.io/zone=a
worker-zone-a-3 topology.kubernetes.io/zone=a
worker-zone-a-4 topology.kubernetes.io/zone=a
worker-zone-b-1 topol... | <p>There is a solution.</p>
<p>First I want to thank @yair-elmaliah for providing the solution in a different channel.
<a href="https://stackoverflow.com/users/16521581/yair-elmaliah">https://stackoverflow.com/users/16521581/yair-elmaliah</a></p>
<p>So, my adjusted setup is as follows.</p>
<p>The nodes in the Kubernete... |
<p>I have an ArgoCD App which is generating symbols</p>
<pre><code>apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "myapp.labels" . | nindent 4 }}
annotations:
helm.sh/hook: pre-install,post-delete
name: {{ include "myapp.fullname" . }}
type: Opaque
data:
{{- if .Values.pas... | <p>Add annotation to that particular object and it should work</p>
<pre><code>apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "myapp.labels" . | nindent 4 }}
annotations:
helm.sh/hook: pre-install,post-delete
argocd.argoproj.io/sync-options: Prune=false
</code></pre>
<blockquote>
<p>... |
<p>I'm having a problem with a simple template-in-template case and I cannot get a working solution. Here's the roundup:</p>
<p>This is a standard template created by Helm itself:</p>
<pre><code>{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to th... | <p>It may be caused by the scope.</p>
<p><code>$</code> represents the root of values.</p>
<p>In the <code>range</code> loop (or <code>with</code> etc), you should use . to represents the current element.</p>
<pre class="lang-yaml prettyprint-override"><code>{{- define "app.userSessionSelector" -}}
workload.u... |
<p>I was going by this update for EKS <a href="https://aws.amazon.com/about-aws/whats-new/2020/03/amazon-eks-adds-envelope-encryption-for-secrets-with-aws-kms/" rel="nofollow noreferrer">https://aws.amazon.com/about-aws/whats-new/2020/03/amazon-eks-adds-envelope-encryption-for-secrets-with-aws-kms/</a> and this blog fr... | <p>I think I found it, the blog and update post by aws are very cryptic.</p>
<p>According to <a href="https://docs.aws.amazon.com/eks/latest/userguide/clusters.html" rel="nofollow noreferrer">docs</a> and console :-</p>
<blockquote>
<p>All of the data stored by the etcd nodes and associated Amazon EBS volumes is encryp... |
<p>This question concerns kubernetes v1.24 and up</p>
<p>So I can create tokens for service accounts with</p>
<pre><code>kubectl create token myserviceaccount
</code></pre>
<p>The created token works and serves the purpose, but what I find confusing is that when I <code>kubectl get sa</code> SECRETS field of myservicea... | <p>Thanks to the <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#service-account-tokens" rel="nofollow noreferrer">docs link</a> I've stumbled upon today (I don't know how I've missed it when asking the question because I've spent quite some time browsing through the docs...) I found th... |
<p>I have Elasticsearch Data pods that are currently running on an AKS and are connected to Persistent Volumes that is using a Premium SSD Managed Disk Storage Class and I want to downgrade it to Standard SSD Managed Disk without losing the data I have on the currently used Persistent Volume.
I've created a new Storage... | <p>Unfortunately, once a PVC is created and a PV is provisioned for it, the only thing you can change without creating a new one is the volume's size</p>
<p>The only straightforward way I could think of without leveraging CSI snapshots/clones, which you might not have access to (depends on how you created PVCs/PVs AFAI... |
<p>The following chain describes how Pods that define an API are reached from the outside.</p>
<pre><code>Client -> Route53 (.example.com)
-> LoadBalancer -> Nginx
-> Service -> Pod
</code></pre>
<p>Some pods, in addition to defining an API, communicate and use the API of others in the same clust... | <p>Yes, you can do it using the CoreDNS <code>rewrite plugin</code>. This is the <a href="https://coredns.io/plugins/rewrite/" rel="nofollow noreferrer">official documentation</a> and I'll give you an example how to implement it.</p>
<ol>
<li>Edit the CoreDNS ConfigMap</li>
</ol>
<pre class="lang-bash prettyprint-overr... |
<p>I am getting the error</p>
<pre><code>dry-run failed, reason: Invalid, error: Deployment.apps "server" is invalid: spec.template.spec.containers[0].env[0].valueFrom: Invalid value:
"": may not be specified when `value` is not empty
</code></pre>
<p>when trying to override a value in <em>flux Kust... | <p>As workaround (mentioned in github issue you linked) you can add "value: null" to configuration:</p>
<pre><code> env:
- name: DATABASE_URL
value: null
valueFrom:
secretKeyRef:
name: server-db-url
key: dburl
</code></pre>
|
<p>I have my app deployed to Kubernetes and it's producing some logs. I can see the logs by running <code>kubectl logs -f <pod-id> -n staging</code>, but I can't find where the logs are physically located on the pod. The <code>/var/log/</code> folder is empty, and I can't find the logs anywhere else on the pod ei... | <p>As @ Achraf Bentabib said</p>
<p>Kubernetes creates a directory structure to help you find logs based on Pods, so you can find the container logs for each Pod running on a node at</p>
<pre><code>/var/log/pods/<namespace>_<pod_name>_<pod_id>/<container_name>/
</code></pre>
<ol>
<li><p>Identif... |
<p>I get the following message when I run the <code>skaffold dev</code> command:</p>
<blockquote>
<p>Build Failed. Cannot connect to the Docker daemon at unix:
///var/run/docker.sock. Check if docker is running.</p>
</blockquote>
<p>Tools versions:</p>
<ol>
<li>MacOS Desktop Docker: 4.13.0 (89412)</li>
<li>Kubernetes: ... | <p>The solution was to set the variable DOCKER_HOST before launching the <code>skaffold dev</code> command:</p>
<pre><code>DOCKER_HOST="unix:///Users/<you>/.docker/run/docker.sock" skaffold dev
</code></pre>
|
<p>If I understand correctly the conditions for Kubernetes to OOM kill a pod or container (<a href="https://komodor.com/learn/how-to-fix-oomkilled-exit-code-137/" rel="nofollow noreferrer">from komodor.com</a>):</p>
<blockquote>
<p>If a container uses more memory than its memory limit, it is terminated with an OOMKille... | <p>Pods aren't OOM killed at all. OOMKilled is a status ultimately caused by a kernel process (OOM Killer) that kills processes (containers are processes), which is then recognised by the kubelet which sets the status on the container. If the main container in a pod is killed then by default the pod will be restarted b... |
<p>I wan to create service account with token in Kubernetes. I tried this:</p>
<p>Full log:</p>
<pre><code>root@vmi1026661:~# ^C
root@vmi1026661:~# kubectl create sa cicd
serviceaccount/cicd created
root@vmi1026661:~# kubectl get sa,secret
NAME SECRETS AGE
serviceaccount/cicd 0 5s
ser... | <p>This is how you can complete your desired commands:</p>
<pre><code>kubectl exec -it <POD_NAME> -c <CONTAINER_NAME> -- /bin/bash
cat /run/secrets/kubernetes.io/serviceaccount/token && echo
</code></pre>
<p>NOTE: if you only have 1 container in your pod, you can omit <code>-c <CONTAINER_NAME>... |
<p>I have an application designed to run as a K8s application, and it imports some dependencies (that I don't own) that run <code>exec.Cmd</code>s. This is fine, except I want to capture those logs. For some reason, when I do:</p>
<pre><code>r := bufio.NewReader(os.Stdout)
...
line, err := r.ReadString('\n')
</code><... | <p>Generally, <code>stdin</code> is a read-only stream for retrieving input written to your program, while <code>stdout</code> is a write-only stream for sending output written by your program. <em>In other words, nobody can read from /dev/stdout, except Chuck Norris.</em></p>
<p>By default, <code>stdout</code> is &quo... |
<p>For example I have StatefulSet with custom labels/annotations applied on it.</p>
<p>Everyone mentions these two metrics should be used, because <code>kube-state-metrics</code> should generate labels/annotations as well.</p>
<pre><code>kube_statefulset_annotations
kube_statefulset_labels
</code></pre>
<p>The thing is... | <p>In order to get custom metrics within <code>kube_statefulset_labels</code> we need to add</p>
<p><code>--metric-labels-allowlist</code> as a flag in kube-state-metrics. (<a href="https://github.com/kubernetes/kube-state-metrics/blob/master/docs/cli-arguments.md#available-options" rel="nofollow noreferrer">docs</a>)<... |
<p>Basically, my kubeconfig file has:</p>
<pre><code>apiVersion: v1
clusters:
- cluster:
server: <OAM ip address> this is what I want
(...)
</code></pre>
<p>I want to get the server address.
Previously searching , I've found this solution:</p>
<pre><code>config, err := clientcmd.BuildConfigFromFlags("... | <p>If you want the server address from the <code>kubeconfig</code> file, just read it from your <code>config</code> variable:</p>
<pre><code>package main
import (
"flag"
"fmt"
"path/filepath"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientc... |
<p>I went through the steps listed here: <a href="https://kubernetes.io/docs/setup/production-environment/tools/kops/" rel="nofollow noreferrer">https://kubernetes.io/docs/setup/production-environment/tools/kops/</a></p>
<p>After moving the kops file to /usr/local/bin/ and renaming to kops, I tried to confirm if it was... | <p>I think its because you are using <code>kops-darwin-amd64</code>. This is for mac. I think you should be using <code>kops-linux-amd64</code> instead for linux.</p>
|
<p>I get the below error in my helm upgrade stage. I did the following change <code>apiVersion: networking.k8s.io/v1beta1</code> to <code>apiVersion: networking.k8s.io/v1</code> Could someone kindly let me know the reason why I encounter this issue and the fix for the same. Any help is much appreciated</p>
<pre><code>E... | <p>The reason why you encounter the issue is Helm attempts to create a diff patch between the current deployed release (which contains the Kubernetes APIs that are removed in your current Kubernetes version) against the chart you are passing with the updated/supported API versions. So when Kubernetes removes an API ver... |
<p>I'm looking to use the Kubernetes python client to delete a deployment, but then block and wait until all of the associated pods are deleted as well. A lot of the examples I'm finding recommend using the watch function something like follows.</p>
<pre><code>try:
# try to delete if exists
AppsV1Api(api_client... | <pre class="lang-py prettyprint-override"><code>import json
def delete_pod(pod_name):
return v1.delete_namespaced_pod(name=pod_name, namespace="default")
def delete_pod_if_exists(pod_name):
def run():
delete_pod(pod_name)
while True:
try:
run()
except ApiExc... |
<p>I recently changed the docker daemon from my local Docker Desktop to local minikube following these <a href="https://minikube.sigs.k8s.io/docs/handbook/pushing/#1-pushing-directly-to-the-in-cluster-docker-daemon-docker-env" rel="nofollow noreferrer">instructions</a>.</p>
<pre><code>@FOR /f "tokens=*" %i IN... | <p>Run the below command to get the list of Docker Hosts..</p>
<pre><code>docker context ls
</code></pre>
<p>output will be something like below</p>
<pre><code>NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default * C... |
<p>I am using Kubectl run command to execute pod on a specific node.</p>
<pre><code>kubectl --namespace=ns run pod1 --image image1 \
--overrides='{"spec":{"nodeSelector":{"appgroup":"app1"}}}' \
--command python3 script.py
</code></pre>
<p>Sometimes pod is going on pending st... | <p>You can do this adding a "tolerations" array.</p>
<p>If you want to ignore all tolerations, we can do this with an "operator=exists" condition.</p>
<pre><code>kubectl --namespace=$your_ns run $your_pod --image $your_image \
--overrides='{"spec":{"nodeSelector":{"appgrou... |
<p>For one of the test AKS clusters I am trying to update, it gives the following error.</p>
<p>Error: SkuNotAvailable.
Message: The requested VM size for resource "Following SKUs have failed for capacity restrictions:
Standard_D4s_v4' is currently not available in location 'SouthAfricaNorth'. Please try another s... | <p>As far as I know, this error "SkuNotAvailable" is either a capacity issue in the region or that your SUBSCRIPTION doesn't have access to that specific size</p>
<p>You could once verify that by running the below Azure cli command
az vm list-skus --location centralus --size Standard_D --all --output table</p... |
<p>I am trying to install Operator Lifecycle Manager (OLM) — a tool to help manage the Operators running on your cluster — from the <a href="https://operatorhub.io/operator/gitlab-runner-operator" rel="nofollow noreferrer">official documentation</a>, but I keep getting the error below. What could possibly be wrong?</p>... | <p><strong>Using PowerShell <em>on Windows</em></strong>, <strong>you must explicitly ensure that the stdout lines emitted by <code>curl.exe</code> are separated with Unix-format LF-only newlines, <code>\n</code>, <em>when PowerShell passes them on to <code>bash</code></em></strong>, given that <code>bash</code>, like ... |
<p>I'm running PowerDNS recursor inside my k8s cluster. My python script is on a different <code>pod</code> that is doing rdns to my <code>powerdns</code> <code>rescursor</code> app. I have my hpa <code>Max replica</code> set to <code>8</code>. However, I do not think the load is the problem here. I'm unsure what to do... | <p>The error code 12 indicates that the PowerDNS recursor did not receive a response from any of the authoritative servers for the queried domain within the configured timeout. This could be due to network issues, firewall rules, rate limiting, or misconfiguration of the recursor or the authoritative servers.</p>
<h2>P... |
<p>Im trying to create a job to list all resources because my connection is terrible. Is there any way to give permission to a pod run the below command?</p>
<p>Here is ClusterRole that I am trying:</p>
<pre><code>kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: istio-system
name: wor... | <p>If you are just looking to give your workload an admin role, you can use the prebuilt <code>cluster-admin</code> cluster role which should be available on every k8s cluster.<br />
See the docs for more details - <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles" rel="nofollow n... |
<p>I am trying to install Operator Lifecycle Manager (OLM) — a tool to help manage the Operators running on your cluster — from the <a href="https://operatorhub.io/operator/gitlab-runner-operator" rel="nofollow noreferrer">official documentation</a>, but I keep getting the error below. What could possibly be wrong?</p>... | <p>To start off, I need to be clear about a few things:</p>
<ol>
<li>Based on the tags to the question, I see we are in PowerShell rather than a linux/unix or even Windows cmd shell</li>
<li>In spite of this, we are using Unix <code>curl</code> (probably <code>curl.exe</code>), and not the PowerShell alias for <code>In... |
<p>I am trying to deploy nats in k8s cluster. I need to override default server config.
Tried creating a configmap with --from-file and attached it to deployment, but it gives me the following error</p>
<pre><code>nats-server: read /etc/nats-server-conf/server.conf: is a directory
</code></pre>
<p>ConfigMap</p>
<pre><c... | <pre><code>- mountPath: /etc/nats-server-conf/server.conf
</code></pre>
<p>The above setting will make a Pod mount <code>server.conf</code> as a directory, so try the below instead:</p>
<pre><code>- mountPath: /etc/nats-server-conf
</code></pre>
|
<pre><code>apiVersion: skaffold/v2alpha3
kind: Config
deploy:
kubectl:
manifests:
- ./infra/k8s/*
build:
local:
push: false
artifacts:
- image: fifapes123/auth
context: auth
docker:
dockerfile: Dockerfile
sync:
manual:
- src: 'src/**/*.ts'
... | <pre><code>apiVersion: skaffold/v3
kind: Config
build:
artifacts:
- image: fifapes123/auth
context: auth
sync:
manual:
- src: src/**/*.ts
dest: .
docker:
dockerfile: Dockerfile
local:
push: false
manifests:
rawYaml:
- ./infra/k8s/*
deploy:
kubectl: {}
</code></pre>
<p>Try the a... |
<p>I'm trying to create a script in order to run multiple <code>kubectl exec</code> commands against multiple pods with multiple containers. The script seems to generate the command just fine but errors out when attempting to run it.</p>
<p>example command that is generated: <code>kubectl -n <namespace> exec <... | <p>The command provided with <code>exec</code> will be executed without a shell. This means that environment variables will not be available. Thus the error specifying missing executable path in $PATH. Only executables installed in default <code>$PATH</code> (like <code>/bin/</code>) can be executed.</p>
<p>You can loa... |
<p>I have following configuration of a service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
name: academy-backend-service
spec:
selector:
app: academy-backend-app
type: NodePort
ports:
- port: 8081
targetPort: 8081
nodePort: 30081
</code></pre>
<p>Behind this service there is a dep... | <p>Use <code>NodePorts</code> to expose the service nodePort on all nodes in the cluster.</p>
<p>From <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a></p>
<blockquote>
<p>NodePort: Exposes the Servic... |
<p>I want to make a command which can clear all old deployments. For example, I have deployments in a namespace</p>
<blockquote>
<p>kubectl -n web get deploy --sort-by=.metadata.creationTimestamp</p>
</blockquote>
<pre><code>myproject-static-staging-master 1/1 1 1 54d
myproject... | <p>You can use xargs command like this:</p>
<pre><code>command1 | xargs -I{} command2 {}
</code></pre>
<p>Xargs will replace the output from command1 with the empty {}. For example, if the output of command1 is '1 2 3', then Xargs will invoke commands: 'command2 1', 'command2 2', and 'command2 3'.</p>
<p>So in your cas... |
<p>I have a GKE Autopilot cluster with one service to publish a message to GCP Pub/Sub topic for testing.</p>
<p>I have created a KSA for the deployment, have used GCP Workload Identity Management to authorize the KSA to act as a GCP Service Account (GSA). Then I gave the GSA the Pub/Sub editor role.</p>
<h3>The follow... | <p>Found the issue.</p>
<p>I missed to annotate the KSA with the email address of the IAM service account.</p>
<p>After these two commands,</p>
<pre class="lang-bash prettyprint-override"><code>kubectl create serviceaccount KSA_NAME
gcloud iam service-accounts add-iam-policy-binding GSA_NAME@PROJECT_ID.iam.gserviceacc... |
<p>Currently, I am developing some back-end API, let's call them A, B and C. I'm willing to use Kubernetes for orchestration.</p>
<p>I need to have Authentication and authorization for only A and B APIs.</p>
<p>How could I implement authentication and authorization for only some api?</p>
| <p>Kubernetes is an orchestration service it doesn't provide the feature of Auth Z/Auth N.</p>
<p>You have options like creating the <strong>Auth</strong> <strong>service</strong> in the backend or using the service Mesh or API gateway to implement the AuthZ/Auth N at the edge.</p>
<p>If you are looking for more functi... |
<p>I need to scale a set of pods that run queue-based workers. Jobs for workers can run for a long time (hours) and should not get interrupted. The number of pods is based on the length of the worker queue. Scaling would be either using the horizontal autoscaler using custom metrics, or a simple controller that changes... | <p>Since version 1.22 there is a beta feature that helps you do that. You can add the annotation <code>controller.kubernetes.io/pod-deletion-cost</code> with a value in the range <code>[-2147483647, 2147483647]</code> and this will cause pods with lower value to be killed first. Default is 0, so anything negative on on... |
<p>I'm using kubernetes plugin in jenkins to do the testing on kubernetes cluster through jenkins pipeline as code. The cluster details change frequently, so I'm configuring the kubernetes plugin through groovy scripts just before the testing stage.</p>
<p>Problem : Jenkins is not able to create pod for testing on the... | <p>I had this problem this week, I solved this by access by accessing: Manage Jenkins => Manage Nodes and Clouds => Configure Clouds => choose your kubernetes Cluster => Kubernetes Cloud details... => set Concurrency Limit to a bigger number(if your current is 10 set it to 20)</p>
|
<p>Create an NetworkPolicy named cka-netpol in the namespace netpol.
1] Allow the pods to communicate if they are running on port 8080 within the namespace.
2] Ensure the NetworkPolicy doesn’t allow other pods that are running other than port 8080.
3] The communication from and to the pods running on port 8080. No pods... | <blockquote>
<p>Allow the pods to communicate if they are running on port 8080 within
the namespace.</p>
</blockquote>
<p>We will only open and accept requests on port <strong>8080</strong> to satisfy the above request.</p>
<blockquote>
<p>The communication from and to the pods running on port 8080. No pods
running on ... |
<p>currently I'm trying the following setup:</p>
<p>I have:</p>
<ul>
<li>one cluster</li>
<li>one Ingress Controller</li>
<li>one url (myapp.onazure.com)</li>
<li>two namespaces for two applications default and default-test</li>
<li>two deployments, ingress objects, services for the namespaces</li>
</ul>
<p>I can easil... | <p>Finally I figured out the missing part. I had to add the following statement to the not working ingress object:</p>
<pre><code> annotations:
kubernetes.io/ingress.class: public-nginx
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1
</code></pre>
<p>... |
<p>I have a container written in go. It deploys and runs on my DockerDesktop & on my Kubernetes cluster in DockerDesktop.</p>
<p>I have pushed the same container to Artefact Repository and it fails to deploy.</p>
<p>So I deployed it to CloudRun, and it works! Very confused.</p>
<p>My GKE cluster is autopilot so I a... | <p>Looking at the error it is clear that node doesnt have sufficient memory and cpu to schedule/run the workload. Check the node configuration and ensure that resources are available on the node to host the workload</p>
<pre><code>Cannot schedule pods: Insufficient cpu.
PodUnschedulable Reason Cannot schedule pods: In... |
<p>I am trying to deploy a K8s application using Kustomize. Up to now I have done simple implementations where we have a few of the K8s files such as <code>ingress.yaml</code> with something like the following:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingressname
namespace: namesp... | <p>Kustomize isn't a templating system and doesn't do variable substitution. It <em>can</em> perform a variety of YAML patching tricks, so one option you have is to start with a base manifest like this:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingressname
spec:
tls:
- hosts: [... |
<p>I am running a regional GKE kubernetes cluster in is-central1-b us-central-1-c and us-central1-f. I am running 1.21.14-gke.700. I am adding a confidential node pool to the cluster with this command.</p>
<pre><code>gcloud container node-pools create card-decrpyt-confidential-pool-1 \
--cluster=svcs-dev-1 \
--disk-si... | <p>One option you have here is to enable private IP addresses for the nodes in your cluster. The <a href="https://cloud.google.com/sdk/gcloud/reference/container/clusters/create#--enable-private-nodes" rel="nofollow noreferrer"><code>--enable-private-nodes</code> flag</a> will make it so the nodes in your cluster get <... |
<p>I have this KongPlugin on Kubernetes</p>
<pre><code>apiVersion: configuration.konghq.com/v1
kind: KongPlugin
config:
remove:
headers:
- Authorization
append:
headers:
- Authorization:Basic <SECRET>
plugin: request-transformer
</code></pre>
<p>Is it possible to move the header Authorization... | <p>if you are using the <strong>request-transformer</strong> Enterprise version you can do it.</p>
<blockquote>
<p>config.append.headers optional</p>
<p>Type: array of string elements List of headername:value pairs. If the
header is not set, set it with the given value. If it is already set,
a new header with the s... |
<p>I am using Loki v2.4.2 and have configured S3 as a storage backend for both index and chunk.</p>
<p>I want to ensure that all logs older than 90 days are deleted without risk of corruption. The documentation about retention is confusing, and steps are not clear. Should I just set TTL on object storage on root prefix... | <p>Deleting old log and index data seems to be the responsibility of S3, not Loki. You'll need to add one or more lifecycle rules to your buckets to handle this.</p>
<p><a href="https://grafana.com/docs/loki/latest/operations/storage/retention/#table-manager" rel="nofollow noreferrer">https://grafana.com/docs/loki/lat... |
<p>I have problem with start order of istio-sidecar and main application in kubernetes.
When pod starts, main application getting error "connection refused" for external services. When istio-envoy proxy ready, main application starts correctly on next attempt.</p>
<p>While Istio is not ready, the main applica... | <p>I believe if you set holdApplicationUntilProxyStarts to true will solve your issue.
You can get more information about it here:
<a href="https://istio.io/latest/docs/ops/common-problems/injection/" rel="nofollow noreferrer">https://istio.io/latest/docs/ops/common-problems/injection/</a>
Hope it can help you.</p>
|
<p>I wanted to deploy Strapi CMS to Kubernetes. On my local machine, I am trying to do this with Minikube. The structure of the project is MySQL in a different container outside of the cluster. I want to access the MySQL database from inside the cluster via this IP <code>172.17.0.2:3306</code></p>
<p>The Database is ou... | <p>First of all you should expose MySQL port 3306 to outside of a container.
Assume host, on which Docker runs MySQL container, has 192.168.0.100 IP address. Then you can <strong>telnet 192.168.0.100:3306</strong> to be sure port is exposed and available.</p>
<p>Here is an example from <a href="https://docs.docker.com/... |
<p>I'm trying to assign static IPs for Load Balancers in GKE to services by storing them in the <code>values.yaml</code> file as:</p>
<pre><code>ip:
sandbox:
service1: xxx.xxx.201.74
service2: xxx.xxx.80.114
dev:
service1: xxx.xxx.249.203
service2: xxx.xxx.197.77
test:
service1: xxx.xxx.123.21... | <p>it could be due to the function changing the context and defined in <code>values.yaml</code></p>
<p>Normally with range, we can use the <strong>$</strong> for global scope, <code>appName: {{ include "common.fullname" $ }}</code></p>
<p>When tested the same template by keeping the static value of the <stron... |
<p>I’ve k8s operator which works as expected, I need to add a “watch” to other operator CRD (not mine), to make it simple lets call it <code>extCR</code> and our operator cr called <code>inCR</code>,</p>
<p>I tried the following but there is an issue how its right to trigger the reconcile.</p>
<pre><code>func (r *Insi... | <p>Few things to keep in mind:</p>
<ul>
<li>Each controller is responsible for <em>exactly</em> one resource.</li>
<li>Reconcile request contains the information necessary to reconcile a Kubernetes object. This includes the information to uniquely identify the object - its Name and Namespace. It does NOT contain inform... |
<p>How to deploy on K8 via Pulumi using the ArgoCD Helm Chart?</p>
<p>Pulumi up Diagnostics:</p>
<pre><code> kubernetes:helm.sh/v3:Release (argocd):
error: failed to create chart from template: chart requires kubeVersion: >=1.22.0-0 which is incompatible with Kubernetes v1.20.0
</code></pre>
<p>THE CLUSTER VERS... | <p>I could reproduce your issue, though I am not quite sure what causes the mismatch between versions. Better open an issue at <a href="https://github.com/pulumi/pulumi-kubernetes" rel="nofollow noreferrer">pulumi's k8s repository</a>.</p>
<p>Looking at the history of <a href="https://github.com/argoproj/argo-helm/blam... |
<p>I have a python program launching a batch job. The job outputs a json file, I'd like to know what is the easiest way to get this result back to the python program that launched it.</p>
<p>So far I thought of these solutions:</p>
<ul>
<li><p>Upload the json file to S3 (pretty heavy)</p>
</li>
<li><p>Display it in the... | <p>An easy way not involving any other databases/pods is to run the first pod as an init container, mount a volume that is shared in both containers and use the JSON file in the next python program. (Also, this approach does not need a persistent volume, just a shared one), see this example:</p>
<p><a href="https://kub... |
<p>We have a Keycloak 15.1.1 deployment on Kubernetes with multiple replicas with the AWS RDS Postgres 13 Database backend. I did not find any upgrade guide or experience of other people regarding this setup or even with Kubernetes with Postgres using PVC upgrading Keycloak with multiple major version changes.</p>
<p>D... | <p>I got the answer from the Keycloak GitHub support forums <a href="https://github.com/keycloak/keycloak/discussions/14682" rel="nofollow noreferrer">https://github.com/keycloak/keycloak/discussions/14682</a>.</p>
<p>Running kc.sh start automatically upgrades the DB on first install, and the first container running th... |
<p>I'm actually trying for a couple of days to setup TLS on my ingress controller.
My Kubernetes cluster is hosted on Azure (AKS).</p>
<p>When I check the Ingress controller logs, I get this :</p>
<blockquote>
<p>W1104 08:49:29.472478 7 backend_ssl.go:45] Error obtaining X.509 certificate: unexpected error creati... | <p>based on below error, appears your cert format is not right.</p>
<blockquote>
<p>no valid PEM formatted block found</p>
</blockquote>
<p>Is your original cert in <a href="https://www.ssl.com/guide/pem-der-crt-and-cer-x-509-encodings-and-conversions/" rel="nofollow noreferrer">PEM</a> format? you can decode the cert ... |
<p>I'm trying work with Strimzi to create kafka-connect cluster and encountering the following error</p>
<pre><code>unable to recognize "kafka-connect.yaml": no matches for kind "KafkaConnect" in
version "kafka.strimzi.io/v1beta2"
</code></pre>
<p>Here's the kafka-connect.yaml I have:</p>... | <p>I think there are two possibilities:</p>
<ol>
<li>You did not installed the CRD resources</li>
<li>You are using Strimzi version which is too old and does not support the <code>v1beta2</code> API</li>
</ol>
<p>Judging that you are trying to use Kafka 2.4.0, I guess the second option is more likely. If you ŕeally wan... |
<p>I am starting up a cluster using minikube and found the node to be started as control-plane node, but interestingly I found the taints to be none. Because the taints is none, I see pods being scheduled on this node.</p>
<pre><code>NAME STATUS ROLES AGE VERSION
minikube Ready control-... | <p>This is the default behavior of minikube because tainting the control plane node is not a Kubernetes requirement especially for the dev/test environments.</p>
<p>You may manually taint your master node using:</p>
<pre><code>kubectl taint nodes minikube node-role.kubernetes.io/master:NoSchedule
</code></pre>
<p>After... |
<p>OpenShift ConfigMap for Jenkins pod template:</p>
<pre><code><org.csanchez.jenkins.plugins.kubernetes.PodAnnotation>
<key>vault.hashicorp.com/agent-limits-ephemeral</key>
<value>100Gi</value>
</org.csanchez.jenkins.plugins.kubernetes.PodAnnotation>
</code></pre>
<p>Spits out:<... | <p>You can remove the <code>value</code> tag:</p>
<pre><code><org.csanchez.jenkins.plugins.kubernetes.PodAnnotation>
<key>vault.hashicorp.com/agent-limits-ephemeral</key>
</org.csanchez.jenkins.plugins.kubernetes.PodAnnotation>
</code></pre>
|
<p>I have setup a backend and frontend service running on Kubernetes. Frontend would be <code>www.<myDomain>.com</code> and backend would be <code>api.<myDomain>.com</code></p>
<p>I need to expose and secure both services. I wish to use one ingress. I want to use free certificates from let's encrypt + cert ... | <p>I faced the same requirement as you.
from</p>
<pre><code> tls:
- secretName: web-ssl
hosts:
- <myDomain>.com
</code></pre>
<p>change to</p>
<pre><code> tls:
- hosts:
- www.<myDomain>.com
secretName: web-ssl
- hosts:
- api.<myDomain>.com
... |
<p>I created PV as follows:</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
name: foo-pv
spec:
storageClassName: "my-storage"
claimRef:
name: foo-pvc
namespace: foo
</code></pre>
<p>Why we need to give storageClassName in PV? When Storage class creates PV, why to give storageClass... | <p>You can have 2 types of PVs:</p>
<ol>
<li>dynamic provisioned by StorageClasses</li>
<li>manually/static created by admins</li>
</ol>
<p><strong>Dynamically</strong> -> this is often used within cloud, for instance when you want to mount an Azure blob/file to a pod. In this case you don't have control over PV nam... |
<p>Crontab to run a job every minute from 11pm to 7:30am</p>
<p>I have this so far which is every minute from 11pm to 7:00am
the problem is the half hour.</p>
<pre><code>* 23,0-7 * * *
</code></pre>
<p>You can play around with it here <a href="https://crontab.guru/#*_23,0-7_*_*_*" rel="nofollow noreferrer">crontab_guru... | <p>@Dunski : I have checked in many ways this <code>*,0-30 23,0-7 * * *</code> expression could stop at 07:59 min only but not yet 07:30 am.</p>
<p>As @jordanm suggested we have only a way to run two jobs from :</p>
<p>11 pm to 7 am expression <code>* 23,0-7 * * *</code> (“At every minute past hour 23 and every hour fr... |
<p>We're creating dynamic test environments for our developers. Each environment goes into one namespace called <code>test-<something></code>, where <code><something></code> is entered by the developer when creating the environment (we use Gitlab-CI for the automation).</p>
<p>We want to grant them limited ... | <p>I also stumbled into this problem and <a href="https://kubernetes.io/blog/2020/08/14/introducing-hierarchical-namespaces/" rel="nofollow noreferrer">Hierarchical Namespaces</a> seem like a decent solution, as you can give the permissions to a single "static" namespace. Every namespace afterwards will inher... |
<p>I want to create a controller and listen to the pod events when new pod is created (by a deployment) then add all labels belong to deployment to the created pod, is this possible at scale with <code>client-go</code>?</p>
| <p>In order to observe pod events, you need to use informers. Informers have built-in optimizations to avoid overloading API servers.</p>
<p>There is a patch method available in the PodInterface that allows you to add a label to a pod.</p>
<p>Here is a sample code for your reference. In the main function, the informer ... |
<p>I'm trying to connect to a cluster and I'm getting the following error:</p>
<pre><code>gcloud container clusters get-credentials cluster1 --region europe-west2 --project my-project
Fetching cluster endpoint and auth data.
CRITICAL: ACTION REQUIRED: gke-gcloud-auth-plugin, which is needed for continued use of kubectl... | <p>I solved the same problem by removing my current <code>kubeconfig</code> context for GCP.</p>
<ol>
<li><p>Get your context name running:</p>
<p>kubectl config get-contexts</p>
</li>
<li><p>Delete the context:</p>
<p>kubectl config delete-context CONTEXT_NAME</p>
</li>
<li><p>Reconfigure the credentials</p>
<p>gcloud... |
<p>I am trying to deploy <strong>istio's sample bookinfo application</strong> using the below command:</p>
<pre><code>kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
</code></pre>
<p>from <a href="https://istio.io/latest/docs/setup/getting-started/#bookinfo" rel="nofollow noreferrer">here</a></p>
<p>but e... | <p>If you check in dockerhub the image is there:</p>
<p><a href="https://hub.docker.com/r/istio/examples-bookinfo-reviews-v1/tags" rel="nofollow noreferrer">https://hub.docker.com/r/istio/examples-bookinfo-reviews-v1/tags</a></p>
<p>So the error that you need to deal with is <code>context deadline exceeded</code> while... |
<p>I want to use the direct translation from k8s secret-keys to SpringBoot properties.
Therefore I have a helm chart (but similar with plain k8s):</p>
<pre><code>apiVersion: v1
data:
app.entry[0].name: {{.Values.firstEntry.name | b64enc }}
kind: Secret
metadata:
name: my-secret
type: Opaque
</code></pre>
<p>With th... | <p>You should be able to use environnment variables like described in <a href="https://github.com/spring-projects/spring-boot/wiki/Relaxed-Binding-2.0#lists-1" rel="nofollow noreferrer">sprint-boot-env</a>.</p>
<p><code>app.entry[0].name</code> property will be set using <code>APP_ENTRY_0_NAME</code> environment variab... |
<p>For example I want to list all the possible values I can put in the yaml file to create a <code>Pod</code>. I want to also look at the meanings of those values. e.g. in the container section you put in the details of the container</p>
| <p>You can see field documentation for a Pod with</p>
<pre><code>kubectl explain Pod
</code></pre>
<p>then you can look deeper into the structure with e.g. (or any other field)</p>
<pre><code>kubectl explain Pod.spec
</code></pre>
|
<p>As said in title, I'm trying to add an AKS cluster to my Azure Machine Learning workspace as <code>Attached computes</code>.</p>
<p>In the wizard that ML studio shows while adding it</p>
<p><a href="https://i.stack.imgur.com/vlVVj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vlVVj.png" alt="ent... | <p><em><strong>I tried to reproduce the same issue in my environment and got the below results</strong></em></p>
<p><em>I have created the Kubernetes cluster and launched the AML studio</em></p>
<p><em>In the AML I have created the workspace and created the compute with AKS cluster</em></p>
<p><img src="https://i.imgur... |
<p>I have a Yaml file in a folder as <code>abc.yaml</code> and the content is</p>
<pre><code>metadata:
test1: apple
test2: banana
test3: cat
container:
image: foo
text: xyz
variables:
ojb: one
meta: two
</code></pre>
<p>and I have another file <code>values.yaml.j2</code> which needs part of the above cont... | <p>If you know the other file is YAML, Helm contains a lightly-documented <code>fromYaml</code> extension that can parse it.</p>
<pre class="lang-none prettyprint-override"><code>{{- $abc := .Files.Get "abc.yaml" | fromYaml }}
</code></pre>
<p>From there you have a couple of options on how to proceed. One to... |
<p>I have a network policy which will allow connection only from my IP address to the NGINX ingress controller. The network policy is given below. The ingress is using a load balancer and app is in different namespace (default).</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: ingre... | <p>You need to set <code>externalTrafficPolicy: Local</code> on the Ingress controller service.</p>
<p>Documentation <a href="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip" rel="nofollow noreferrer">here</a></p>
<p>Setting this allows the orig... |
<p>I'm using a HPA based on a custom metric on GKE.</p>
<p>The HPA is not working and it's showing me this error log:</p>
<blockquote>
<p>unable to fetch metrics from custom metrics API: the server is currently unable to handle the request</p>
</blockquote>
<p>When I run <code>kubectl get apiservices | grep custom</cod... | <p>Adding this block in my EKS nodes security group rules solved the issue for me:</p>
<pre><code>node_security_group_additional_rules = {
...
ingress_cluster_metricserver = {
description = "Cluster to node 4443 (Metrics Server)"
protocol = "tcp"
... |
<p>I have some pods running that are talking to each other via Kubernetes services and not via the pod IP's and now I want to lock things down using Network Policies but I can't seem to get the egress right.</p>
<p>In this scenario I have two pods:</p>
<ul>
<li><code>sleeper</code>, the client</li>
<li><code>frontend</... | <p>I recreated your deployment and the final networkpolicy (egress to <code>kube-system</code> for DNS resolution) solves it for me. Make sure that after applying the last network policy, you're testing the connection to service's port (8080) which you changed in you're <code>wget</code> command when accessing the pod ... |
<p>I currently have a go app that uses a lot <code>fmt.printf</code>. Whenever that app would run in a pod I was able to get the logs back by doing</p>
<p><code>kubectl logs podname</code></p>
<p>However I also needed to integrate remote debugging. I need to use <code>dlv</code> to allow my ide(GoLand) to remotely conn... | <p>You can use the <code>--continue</code> exec flag, to continue the debugged process on the start, which then will lead to continued logs.</p>
<p>So start delve e.g. with:</p>
<pre><code>dlv --listen=:2345 --headless exec your/app --continue
</code></pre>
<p>Without the <code>--continue</code> flag, delve will wait f... |
<p>I have a small NodeJS script that I want to run inside a container inside a kubernetes cluster as a CronJob. I'm having a bit of a hard time figuring out how to do that, given most examples are simple "run this Bash command" type deals.</p>
<p>package.json:</p>
<pre><code>{
...
"scripts": {
... | <p>The error you show about the path not being found should appear when you <code>docker run ...</code> - but it didn't!</p>
<p>So, I assume it is related to the <code>imagePullPolicy</code>. Something is fixed, checked locally and then re-pushed to the given registry for your Kubernetes workloads to use. If it was re-... |
<p>I am using node version v17.9.0.
OS is Linux.
I am using Kubernetes and launching a nodejs application to connect with snowflake and execute a query.</p>
<p>version of snowflake-promise is 2.2.0.
version of snowflake-sdk is 1.6.14.</p>
<p>I am getting below error while connecting to snowflake. Can you please suggest... | <p>I got this error too..</p>
<p>This error occurs when you are working in organisation environment!
You can reach Admin team to enable access to snowflake inside your deployment environment!! and if it is happening in local environment you need to enable proxies</p>
|
<p>Following the YugabyteDB Voyager database migration steps (<a href="https://docs.yugabyte.com/preview/migrate/migrate-steps/" rel="nofollow noreferrer">https://docs.yugabyte.com/preview/migrate/migrate-steps/</a>) going from PostgreSQL to YugabyteDB on a local Kubernetes, on Docker Desktop, on WSL2, on Windows.
Usin... | <p>Putting solution here in case anybody runs into this issue.
If there is a Load Balancer is present and YugabyteDB server's IP is not resolvable from the voyager machine, then import data command is erroring out.
Ideally it should use the load balancer for importing the data.</p>
<p>Use <code>--target-endpoints=LB_HO... |
<p>I'm running a kubernetes cluster (bare metal) with a mongodb (version 4, as my server cannot handle newer versions) replicaset (2 replicas), which is initially working, but from time to time (sometimes 24 hours, somtimes 10 days) one or more mongodb pods are failing.</p>
<pre><code>Warning BackOff 2m9s (x43454 ove... | <p>Generally when you see this error message:</p>
<pre><code>"error":"DBPathInUse: Unable to create/open the lock file: /bitnami/mongodb/data/db/mongod.lock (Read-only file system)
</code></pre>
<p>It most probably mean that your mongodb pod did not shutted down gracefully and had no time to remove the m... |
<p>Since I lost data because I removed (accidently) a namepace including a persistant volume, I am trying to enable Backup for my GKE cluster.</p>
<p>But after I try to enable it I get the message:</p>
<p>'Etcd alias ip must be enabled for Backup for GKE addon.'</p>
<p>I cannot find anything when searching for this, I ... | <p>Thank you for the replies, I just tried again and now it is working. I don't know why, did not make any other changes.</p>
|
<p>I use Spark 2.4.0 + K8s cluster deployment mode + python 3.5.</p>
<p>I pack all libraries into zip archive and send it to AWS S3, then attach to context</p>
<pre><code>sc = pyspark.SparkContext(appName=args.job_name, environment=environment)
sc.addPyFile('s3a://.../libs.zip')
sc.addPyFile('s3a://.../code.zip')
</... | <p>Some pip-installed packages are not safe to be compressed into a zip. For example, used <a href="https://github.com/apache/airflow/blob/5786dcdc392f7a2649f398353a0beebef01c428e/setup.py#L685" rel="nofollow noreferrer">Airflow v1.10.15 was not ZIP-safe</a> (not sure about new versions)</p>
|
<p>I have a program which I have set up several jobs inside it. According to the figure, these jobs are executed every day at a certain time and, for example, send an SMS to a group of numbers.
When I deploy this to Kubernetes, multiple copies are created.
I want to know, do all these original and replica versions do t... | <p>You can use <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">CronJob</a> for that.</p>
<p>Since you have a single application with all cronjob code. You can modify the c# application to use an environment variable to decide the job type. This way you can create... |
<p>I am trying to write a network policy on Kubernetes that works under AWS EKS. What I want to achieve is to allow traffic to pod/pods from the same Namespace and allow external traffic that is forwarded from AWS ALB Ingress.</p>
<p>AWS ALB Ingress is created under the same NameSpace so I was thinking that only using... | <p>The semantics of the built-in Kubernetes NetworkPolicies are kind of fiddly. There are no deny rules, only allow rules.</p>
<p>The way they work is if no network policies apply to a pod, then all traffic is allowed. Once there is a network policy that applies to a pod, then all traffic <em>not allowed</em> by that p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.