Question stringlengths 65 39.6k | QuestionAuthor stringlengths 3 30 ⌀ | Answer stringlengths 38 29.1k | AnswerAuthor stringlengths 3 30 ⌀ |
|---|---|---|---|
<p>Based on <a href="https://stackoverflow.com/questions/59920413/podman-add-ports-to-expose-to-running-pod">podman-add-ports-to-expose-to-running-pod</a>
as quote From <a href="https://stackoverflow.com/a/60143446/4870357">Dominic P</a>:</p>
<blockquote>
<p>once the pod is created these attributes are assigned to the ... | Zaman | <p>You could generate a Kubernetes pod manifest from your running pod using <code>podman generate kube <podname></code>, edit the resulting file, and then re-create the pod with <code>podman kube play <manifest>,yaml</code>.</p>
<p>For example:</p>
<p>I create a pod and spin up a webserver...</p>
<pre><code... | larsks |
<p>We have a fairly large kubernetes deployment on GKE, and we wanted to make our life a little easier by enabling auto-upgrades. The <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-upgrades" rel="nofollow noreferrer">documentation on the topic</a> tells you how to enable it, but not how it ac... | averell | <p>I'll finally answer this myself. The auto-upgrade <em>does</em> work, though it took several days to a week until the version was upgraded.</p>
<p>There is no indication of the planned upgrade date, or any feedback other than the version updating.</p>
<p>It will upgrade to the current master version of the cluster... | averell |
<p>I want to enable the security features of ElasticSearch and according to <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html" rel="nofollow noreferrer">this</a> tutorial I need to add <code>xpack.security.enabled: true</code> to elasticsearch.yml to do so.</p>
<p>I tried... | Jens Voorpyl | <p>If I understand you correctly, you main goal is simply to edit the <code>/usr/share/elasticsearch/config/elasticsearch.yml</code> file and then have elastisearch start up as normal?</p>
<p>I that case a ConfigMap and a VolumeMount are your friend.</p>
<p>TL;DR: Create a ConfigMap with the <em>entire</em> contents th... | Karl |
<p>Trying to export vault secrets as an environment variable to k8s pod using vault injector. Following vault documentation <a href="https://developer.hashicorp.com/vault/docs/platform/k8s/injector/examples#environment-variable-example" rel="nofollow noreferrer">https://developer.hashicorp.com/vault/docs/platform/k8s/i... | Meet101 | <p>You can use the <a href="https://github.com/hashicorp/vault-secrets-operator/" rel="nofollow noreferrer">Vault Secrets Operator</a> to synchronize secrets from Vault to Kubernetes <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">Secret</a> resources.</p>
<p>Once you've do... | larsks |
<p>I am trying to create a service which follows vertical replication-</p>
<p><a href="https://i.stack.imgur.com/olfNe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/olfNe.png" alt="enter image description here" /></a></p>
<p>In this architecture, requestes goes to the master node. For that I can us... | Prateek Agrawal | <p>I'm not sure how to do this using <em>just</em> an ingress resource, but it would be very easy if you were to deploy an haproxy pod in front of your services, so that your architecture looks like this:</p>
<p><a href="https://i.stack.imgur.com/H7HKx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/... | larsks |
<p>Can I a list all the namespaces using a role and not a clusterrole resource? If yes, can anyone help me with some example</p>
| Mahesh | <p>Namespaces are cluster-wide objects.</p>
<p>The only way to access them is if there exists a ClusterRoleBinding and a corresponding ClusterRole that gives your principal (user, service account,etc) permissions to list namespaces.</p>
| larsks |
<p>I have this kubeconfig file</p>
<pre><code>apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ***
server: ***
name: ***
contexts:
- context:
cluster: ***
user: webhook
name: *****
current-context: *****
kind: Config
preferences: {}
users:
- name: webhook
user:
token: ${MY_APIKE... | Amin Ba | <p>You need to properly quote your variables. Consider what happens if I create a multiline environment variable:</p>
<pre><code>MVAR='this
is
a
test'
</code></pre>
<p>And then try to echo it without using quotes:</p>
<pre><code>$ echo $MYVAR
this is a test
</code></pre>
<p>Compare that to the result when using quotes:... | larsks |
<p>If I have a ConfigMap like so:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
name: id-config
data:
uuid: "{{ randAlphaNum 32 }}"
</code></pre>
<p>and a StatefulSet specification like so (taken and slightly modified from kubernetes' <a href="https://kuber... | quantumferret | <p>When you deploy something with Helm you need to differentiate between two distinct things that are happening:</p>
<ol>
<li>Rendering the manifests, which happens locally on the machine where you execute the <code>helm</code> CLI.</li>
<li>Deploying the rendered manifests. I.e. sending the instruction to the Kubernet... | Karl |
<p>I would like permit a Kubernetes pod in namespace <code>my-namespace</code> to access <code>configmap/config</code> in the same namespace. For this purpose I have defined the following <code>role</code> and <code>rolebinding</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: List
item... | rookie099 | <p>I don't see anything in particular wrong with your Role or
Rolebinding, and in fact when I deploy them into my environment they
seem to work as intended. You haven't provided a complete reproducer in your question, so here's how I'm testing things out:</p>
<ul>
<li><p>I started by creating a namespace <code>my-names... | larsks |
<p>Let's say I create a PersistentVolume of type hostPath:</p>
<pre class="lang-yaml prettyprint-override"><code>kind: PersistentVolume
apiVersion: v1
metadata:
name: mypv
spec:
storageClassName: normal
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: /etc/foo # Path on the ho... | KJ0797 | <p>The <code>mountPath</code> is the mountpoint inside the container. It is an absolute path starting at the <em>container's</em> filesystem root. If <code>mountPath</code> is <code>/var/log</code>, then the volume will be mounted on <code>/var/log</code> inside the container.</p>
<p>If you have a <code>hostPath</code>... | larsks |
<p>Docker provides the following functions to stop and start the same container.</p>
<pre><code>OP46B1:/ # docker stop 18788407a60c
OP46B1:/ # docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORT... | Wei Yang | <p>k3s is a distribution of kubernetes. Kubernetes is an abstraction over the container framework (containerd/docker/etc.). As such, you shouldn't try to control the containers directly using <code>k3s crictl</code>, but instead use the pod abstraction provided by kubernetes.</p>
<p><code>k3s kubectl get pods -A</code>... | T0xicCode |
<p>I'm new to k8s and trying to get a cluster on GKE set up. I had it working close with just services and nginx built into the frontend image, however the routing was not working correctly, so looking online and its clear I should use an ingress. Been trying to get the nginx-ingress set up, but keep getting a 404 resp... | Jowz | <p>I think the primary problem here is that you've misspelled some of the annotations on your Ingress resource.</p>
<ol>
<li><p>You wrote <code>user</code> where you meant <code>use</code>. Instead of:</p>
<pre><code>nginx.ingress.kubernetes.io/user-regex: "true"
</code></pre>
<p>You need:</p>
<pre><code>ngin... | larsks |
<p>In my project, we let developers update a repo containing all of the kubernetes manifests. The repo uses kustomize. I've decided to add a validation / lint step to our CI to catch mistakes early.</p>
<p>To do so, I'm trying to run <code>kustomize build</code> on everything in the repo. Where I'm running into trouble... | 101010 | <p>The solution is to create a dummy filter for processing ksops resources. For example, something like this:</p>
<pre><code>mkdir -p fakeplugins/viaduct.ai/v1/ksops
ln -s /bin/true fakeplugins/viaduct.ai/v1/ksops/ksops
export KUSTOMIZE_PLUGIN_HOME=$PWD/fakeplugins
kustomize build --enable-alpha-plugins
</code></pre>
... | larsks |
<p>I have a cronjob that sends out emails to customers. It occasionally fails for various reasons. I <em>do not want</em> it to restart, but it still does.</p>
<p>I am running Kubernetes on GKE. To get it to stop, I have to delete the CronJob and then kill all the pods it creates manually. </p>
<p>This is bad, f... | Doug | <p>It turns out that you have to set a <code>backoffLimit: 0</code> in combination with <code>restartPolicy: Never</code> in combination with <code>concurrencyPolicy: Forbid</code>. </p>
<p><strong>backoffLimit</strong> means the number of times it will retry before it is considered failed. The default is 6.</p>
... | Doug |
<p>As an IT contractor, I was tasked with fixing an issue in a client's software which made simple use of a third-party library to encrypt or decrypt byte strings. For reasons relating to AWS temporary access tokens, the library required occasional reinitialisation for a fresh access token to be acquired (via AWS EKS) ... | John R Ramsden | <blockquote>
<p>But the client rep said this might cause problems in a Kubernetes pod, relating to access rights and process monitoring among other things.</p>
</blockquote>
<p>There is nothing special about kubernetes with respect to child processes and access rights. It's just Unix processes: a child runs with the sa... | larsks |
<p>In K8s i'm practising the example <em>6.1. A pod with two containers sharing the same volume: fortune-pod.yaml</em> from the book <strong>kubernetes in Action</strong>. In volumes concept where my pod contain 2 containers, one of the containers is not running, Please guide me where i'm doing wrong. to run the pod su... | Praveen | <p>Your <em>Pod</em> named <code>vol-1</code> has two <em>containers</em>:</p>
<ul>
<li>One named <code>fortune-cont</code></li>
<li>One named <code>web-server</code></li>
</ul>
<p>If you run <code>kubectl logs vol-1</code>, Kubernetes doesn't know which container you're asking about, so it has to pick one, and tells y... | larsks |
<p>We want to use <a href="https://hub.tekton.dev/tekton/task/buildpacks" rel="nofollow noreferrer">the official Tekton buildpacks task</a> from Tekton Hub to run our builds using Cloud Native Buildpacks. The <a href="https://buildpacks.io/docs/tools/tekton/" rel="nofollow noreferrer">buildpacks documentation for Tekto... | jonashackt | <p><a href="https://github.com/tektoncd/cli/" rel="nofollow noreferrer">tkn cli</a> has the switch --use-pipelinerun to the command <code>tkn pipeline start</code>, what this command does is to reuse the params/workspaces from that pipelinerun and create a new one, so effectively "restarting" it.</p>
<p>so to... | Chmouel Boudjnah |
<p>I am naive in Kubernetes world. I was going through a interesting concept called headless service.</p>
<p>I have read it, understand it, and I can create headless service. But I am still not convinced about use cases. Like why do we need it. There are already three types of service clusterIP, NodePort and loadbalanc... | Rohit | <p>A headless service doesn't provide any sort of proxy or load balancing -- it simply provides a mechanism by which clients can look up the ip address of pods. This means that when they connect to your service, they're connecting <em>directly</em> to the pods; there's no intervening proxy.</p>
<p>Consider a situation ... | larsks |
<p>I'm trying to apply the same job history limits to a number of CronJobs using a <a href="https://github.com/kubernetes-sigs/kustomize/blob/572d5841c60b9a4db1a75443b8badb7e8334f727/examples/patchMultipleObjects.md" rel="nofollow noreferrer">patch</a> like the following, named <code>kubeJobHistoryLimit.yml</code>:</p>... | Tianxiang Xiong | <p>With kustomize 4.5.2, your patch as written doesn't apply; it fails with:</p>
<pre><code>Error: trouble configuring builtin PatchTransformer with config: `
path: kubeJobHistoryLimit.yml
target:
kind: CronJob
`: unable to parse SM or JSON patch from [apiVersion: batch/v1
kind: CronJob
spec:
successfulJobsHistoryL... | larsks |
<p>kustomize build --enable-helm .I have the following project structure:</p>
<pre><code>project
- helm-k8s
- values.yml
- Chart.yml
- templates
- base
- project-namespace.yml
- grafana
- grafana-service.yml
- grafana-deployment.yml
- grafana-datasource-config.yml
... | joesan | <p>I think you may have misunderstood the use of the <code>--enable-helm</code> parameter. It does not allow kustomize to perform helm-style templating on files, so when you write:</p>
<pre><code>apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.app.namespace }}
labels:
name: {{ .Values.app.namespace }}... | larsks |
<p>How to parse the json to retrieve a field from output of </p>
<pre><code>kubectl get pods -o json
</code></pre>
<p>From the command line I need to obtain the system generated container name from a google cloud cluster ... Here are the salient bits of json output from above command :
<a href="https://i.stack.imgur... | Scott Stensland | <p>After much battling this one liner does retrieve the container name :</p>
<pre><code>kubectl get pods -o=jsonpath='{.items[?(@.metadata.labels.name=="web")].metadata.name}'
</code></pre>
<p>when this is the known search criteria :</p>
<pre><code>items[].metadata.labels.name == "web"
</code></pre>
<p>and this is... | Scott Stensland |
<p>I'm configuring Traefik Proxy to run on a GKE cluster to handle proxying to various microservices. I'm doing everything through their CRDs and deployed Traefik to the cluster using a custom deployment. The Traefik dashboard is accessible and working fine, however when I try to setup an IngressRoute for the service i... | Zach W | <p>A default Traefik installation on Kubernetes creates two entrypoints:</p>
<ul>
<li><code>web</code> for http access, and</li>
<li><code>websecure</code> for https access</li>
</ul>
<p>But you have in your <code>IngressRoute</code> configuration:</p>
<pre><code>entryPoints:
- service-port
</code></pre>
<p>Unless ... | larsks |
<p>I have a job that runs on deployment of our app. The job runs fine 99.9% of the time but every so often something goes wrong (in the application config) and we need to run commands by hand. Because the job has several initContainers it's not as simple as just running an instance of an application pod and execing int... | Mr Morphe | <h2>Option 1: Just re-submit the job</h2>
<p>"Converting a job into a pod" is basically what happens when you submit a Job resource to Kubernetes...so one option is just to delete and re-create the job:</p>
<pre><code>kubectl get job myjob -o json | kubectl replace --force -f-
</code></pre>
<p>Poof, you have ... | larsks |
<p>I am trying to use the module <a href="https://docs.ansible.com/ansible/latest/collections/community/kubernetes/k8s_module.html" rel="nofollow noreferrer">community.kubernetes.k8s – Manage Kubernetes (K8s) objects</a> with variables from the role (e.g. role/sampleRole/vars file).</p>
<p>I am failing when it comes to... | Thanos | <p>You could try the following as a workaround; in this example, we're creating a text template, and then using the <code>from_yaml</code> filter to transform this into our desired data structure:</p>
<pre><code>- name: sample ... | larsks |
<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("... | digolira2 | <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... | larsks |
<p>Hi I am trying to add built-in OpenShift(v4.8) prometheus data source to a local grafana server. I have given basic auth with username and password and as of now I have enabled skip tls verify also. Still I'm getting this error</p>
<p><a href="https://i.stack.imgur.com/xvKu8.png" rel="nofollow noreferrer"><img src="... | Ashutosh Patole | <p>You cannot authenticate to the OpenShift prometheus instance using basic authentication. You need to authenticate using a bearer token, e.g. one obtained from <code>oc whoami -t</code>:</p>
<pre><code>curl -H "Authorization: Bearer $(oc whoami -t)" -k https://prometheus-k8s-openshift-monitoring.apps.xxxx.x... | larsks |
<p>I having hard time looping over array values in values.yaml. The Error some kind of syntax/yaml structure related error but the message is so cryptic I have no idea what the issue is:
My values.yaml file:</p>
<pre class="lang-yaml prettyprint-override"><code>agent:
namespace: "" <values are subject to ... | Ricky18 | <p>Your problem is with the <em>body</em> of your <em>range</em> loops. When you write this:</p>
<pre><code>{{- range .Values.agent.admin_group }}
...
{{- end}}
</code></pre>
<p>Then you're redefining the meaning of <code>.</code>. Within the loop, <code>.</code> refers to each successive value produced by the <code>ra... | larsks |
<p>I want to add a resource limit and request using Kustomize if and only if it's not already configured. Problem is that the deployment is in fact a list of deployments, so I cannot use default values:</p>
<p>values.yaml</p>
<pre><code>myDeployments:
- name: deployment1
- name: deployment2
resources:
l... | theplayer777 | <p>You can't make Kustomize conditionally apply a patch based on whether or not the resource limits already exists. You <em>could</em> use labels to identify deployments that should receive the default resource limits, e.g. given something like:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
name: exam... | larsks |
<p>I am attempting to install <code>istio</code> in my DO K8s cluster.</p>
<p>I have created a null resource to download <code>istio</code> and run the helm charts using this example - <a href="https://mohsensy.github.io/sysadmin/2021/04/09/install-istio-with-terraform.html" rel="nofollow noreferrer">https://mohsensy.g... | cs1193 | <p>The error is trying to help you out:</p>
<pre><code>unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
</code></pre>
<p>Take a look at the API resources available in your Kubernetes enviornment:</p>
<pre><code>$ kubectl api-r... | larsks |
<p>I used the following yaml to create a postgres deployment in my kubernetes cluser.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: database-secret
namespace: todo-app
data:
# todoappdb
db_name: dG9kb2FwcGRiCg==
# todo_db_user
username: dG9kb1... | Nishant Mittal | <p>You have an error in your <code>Secret</code>. If you base64-decode these values:</p>
<pre><code>data:
# todoappdb
db_name: dG9kb2FwcGRiCg==
# todo_db_user
username: dG9kb19kYl91c2VyCg==
# password
password: cGFzc3dvcmQK
</code></pre>
<p>You will find that they all include a terminal <code>\n</code> char... | larsks |
<p>I am containerizing spring-boot applications on kubernetes and I want to have a different application property file for each replica of POD.
As I want to have different config for different pod replicas.</p>
<p>Any help on above would be appreciated.</p>
| user3132096 | <p>They're not really replicas if you want a unique configuration for each pod. I think you may be looking for a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer"><code>StatefulSet</code></a>. Quoting from the docs:</p>
<blockquote>
<p>Like a Deployment, a Statef... | larsks |
<p>I'm using Traefik 2.7.0 on an AKS Kubernetes Cluster 1.22.6.
Currently, everything routes to the same service:</p>
<pre><code>apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: api
namespace: namespace1
spec:
entryPoints:
- websecure
routes:
- match: Host(`api.my-domain.com`)... | Pascal Paulis | <p>You can only expose services in the same namespace as your IngressRoute resource. If you watch the logs of your Traefik pod when you deploy your IngressRoute, you should see something like:</p>
<blockquote>
<p>time="2023-01-26T13:57:17Z" level=error msg="service namespace2/users-api not in the parent ... | larsks |
<p>I'm trying to use Kustomize but as a result I have wrong placeholder lines.</p>
<p>I have <code>base/deployment.yaml</code> like this:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
name: app
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
labels:
... | Victoria Agafonova | <p>This isn't going to work the way you want: because <code>containers:</code> is a list, Kustomize uses the container name to identify which element you want to modify. Because the container name in your patch doesn't match an existing container name, you are <em>adding a new container</em> to the deployment. That's w... | larsks |
<p>I'm trying to add envs injection based on <code>envFrom</code></p>
<p>A simplified structure looks something like that:</p>
<pre><code>├── base
│ ├ ─ backend
│ ├── backend.properties
│ ├── app1
│ │ ├── app1_backend.properties
├ ── deployment.yaml
│ │ ├── ingress.yaml
│ ... | rafal1337 | <p>It's hard to diagnose your problem without a reproducible example, but if I start with this <code>Deployment</code>:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
name: example
spec:
replicas: 1
selector:
matchLabels:
app: example
template:
spec:
containers:
- name... | larsks |
<p>My Kubernetes deployment has an <code>initContainer</code> which fetches a token from a URL. My app container (3rd party) then needs that token as an environment variable.</p>
<p>A possible approach would be: the <code>initContainer</code> creates a Kubernetes Secret with the token value; the app container <a href="... | Max | <blockquote>
<p>Creating the Secret from the initContainer requires accessing the Kubernetes API from a Pod though, which tends to be a tad cumbersome...</p>
</blockquote>
<p>It's not actually all that bad; you only need to add a ServiceAccount, Role, and RoleBinding to your deployment manifests.</p>
<p>The ServiceAcco... | larsks |
<p>I have a kubernetes pod configuration with a named volume and want to run it via <code>podman play kube</code> which fails for an unknown reason:</p>
<p><code>podman play kube kubernetes.yml</code>:</p>
<pre><code>Error: kubernetes.yml: Volume mount database-data-volume specified for container but not configured in ... | asbachb | <p>Your <code>volume</code> is missing a name (this would fail on Kubernetes as well). The <code>volumes</code> section maps a volume name to some sort of volume definition; when you write:</p>
<pre><code> volumes:
- persistentVolumeClaim:
claimName: database-data-volume
</code></pre>
<p>You have a volume ... | larsks |
<p>I can't seem to find any clear information on this anywhere, but is it possible in a Helm chart to require a third party, such as <code>stable/jenkins</code>, and specify configuration values? </p>
<p>All the examples I see are for running the <code>helm install</code> command directly but I would like to be able t... | Ryall | <p>In answer, @desaintmartin referred me to these documents in Slack:</p>
<ul>
<li><a href="https://helm.sh/docs/chart_template_guide/subcharts_and_globals/" rel="nofollow noreferrer" title="Subcharts and Globals">Subcharts and Globals</a></li>
<li><a href="https://helm.sh/docs/topics/chart_best_practices/dependencies/... | Ryall |
<p>I am mounting a ConfigMap volume to a pod using Go k8 cient where <code>template-conf</code> is a file (deployed helm yaml in the namespace)</p>
<pre class="lang-golang prettyprint-override"><code> pod.Spec.Volumes = append(pod.Spec.Volumes, corev1.Volume{
Name: "conf",
VolumeSource: cor... | koonig | <p>ConfigMap resource is not designed to be modified directly by replacing the entire contents or appending lines.</p>
<p>Try:</p>
<pre><code>// Retrieve the existing ConfigMap
configMap, err := clientset.CoreV1().ConfigMaps("namespace").Get(context.TODO(), "template-conf", metav1.GetOptions{})
if e... | Andrew Arrow |
<p>I was wondering if is possible to get resources from <a href="https://kustomize.io/" rel="noreferrer">kustomize</a> in a private GitHub repository, I already tried something like this without success</p>
<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- git@github.com:gituser/... | user3573246 | <p>Your remote resource needs to resolve to a <em>directory</em> that contains a
<code>kustomization.yaml</code> file. That is, instead of:</p>
<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- git@github.com:gituser/kustomize.git/kustomize/main/nginx.yaml
</code></pre>
<p>You need... | larsks |
<p>I am searching for a solution that enables me to set up a single node K8s cluster and if I needed I add nodes to it later.</p>
<p>I am aware of solutions such as minikube and microk8s but they are not expandable. I am trying k3s at the moment exactly because it is offering this feature but I have some problems with... | AVarf | <p>You can use <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/" rel="nofollow noreferrer">kubeadm</a> to setup a single node "cluster". Then you can use the <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/" rel="nofollow noreferrer">j... | fat |
<p>I used below file to create service account</p>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
name: sa-reader
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
name: reader-cr
... | Vikas Rathore | <p>You can operate on a namespace explicitly by using the <code>-n</code> (<code>--namespace</code>) option to <code>kubectl</code>:</p>
<pre><code>$ kubectl -n my-other-namespace get pod
</code></pre>
<p>Or by changing your default namespace with the <code>kubectl config</code> command:</p>
<pre><code>$ kubectl config... | larsks |
<p>Using <code>crictl an </code>containerd<code>, is there an easy way to find to which pod/container belongs a given process, using it's </code>PID` on the host machine?</p>
<p>For example, how can I retrieve the name of the pod which runs the process below (<code>1747</code>):</p>
<pre><code>root@k8s-worker-node:/# p... | Fabrice Jammes | <p>Assuming that you're looking at the primary process in a pod, you could do something like this:</p>
<pre><code>crictl ps -q | while read cid; do
if crictl inspect -o go-template --template '{{ .info.pid }}' $cid | grep -q $target_pid; then
echo $cid
fi
done
</code></pre>
<p>This walks through all the... | larsks |
<p>I hope all is well!</p>
<p>I'm trying to wrap my head around Ingresses and Services. I'm trying to reach my pod thru my ingress hostname:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
labels:
app.kubernetes.io/instance: oc-backend
app.kuberne... | Fares | <p><strong>Update 1</strong></p>
<p>Given this output:</p>
<pre><code>NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
oc-backend LoadBalancer 10.109.58.97 127.0.0.1 80:32026/TCP 26h
</code></pre>
<p>You're trying to reach the service using the cluster ip. That's not going to work... | larsks |
<p>I'm trying to incorporate a helm chart into my kustomize setup. So I have added it to my <code>kustomization.yaml</code>:</p>
<pre><code>...
helmGlobals:
chartHome: ../test/vault
helmCharts:
- name: helm-vault
valuesFile: ../test/vault-values.yaml
...
</code></pre>
<p>When I try to build this on command line... | thoredge | <p>It may seem like <code>kustomize</code> have a problem with <code>snap</code> in some way. I downloaded a binary version from the <a href="https://github.com/helm/helm/releases" rel="nofollow noreferrer">helm release page</a> and specifying that binary with <code>--helm-command</code> seems to remove the problem ent... | thoredge |
<p>I have a huge patch file that I want to apply to specific overlays. I usually patch files under overlays as it is supposed to be. But the file is same and I do not want to copy it to each overlay. If I could keep my patch file <code>app-new-manifest.yaml</code> under base and patch it under overlay with a single lin... | titanic | <p>You can't include a file that is outside of you current directory, but you <em>can</em> include another directory that has a <code>kustomize.yaml</code> file. So organize your layout like this:</p>
<pre><code>.
├── base
└── overlay
├── patched_based
├── environment1
├── environment2
└── environment3
... | larsks |
<p>If I do</p>
<pre><code>POD=$($KUBECTL get pod -lsvc=app,env=production -o jsonpath="{.items[0].metadata.name}")
kubectl debug -it --image=mpen/tinker "$POD" -- zsh -i
</code></pre>
<p>I can get into a shell running inside my pod, but I want access to the filesystem for a container I've called &qu... | mpen | <p>Reading through <a href="https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/" rel="nofollow noreferrer">the documentation</a>, using <code>kubectl debug</code> won't give you access to the filesystem in another container.</p>
<p>The simplest option may be to use <code>kubectl exec</code> to s... | larsks |
<p>I have an overlay <code>kustomization.yaml</code> as following:</p>
<pre><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base/
patches:
- patch.yaml
secretGenerator:
- name: my-secrets
env: password.env
</code></pre>
<p>When applying it with embedded <code>ku... | Andrey | <p>Turns out that newer versions of kustomize use <code>envs</code> parameter instead of <code>env</code></p>
| Andrey |
<p>I'm just adding the containers part of the spec. Everything is otherwise set up and working fine and values are hardcoded here. This is a simple Postgres pod that is part of a single replica deployment with its own PVC to persist state. But the problem is having nothing to do with my pod/deployment setup.</p>
<pre><... | Happy Machine | <p>With your pod spec, you've replaced the default command -- which starts up the postgres server -- with your own command, so the server never starts. The proper way to perform initialization tasks with the official Postgres image is <a href="https://github.com/docker-library/docs/blob/master/postgres/README.md#initia... | larsks |
<p>how can I add object to array via Kustomize? As a result I would like to have two <code>ServiceAccount</code>s added to <code>subjects</code>, like so:</p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Clu... | Murakami | <p>If I start with a ClusterRoleBinding that looks like this in <code>crb.yaml</code>:</p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects: []
</code></pre>
<p... | larsks |
<p>Any ideas how can I replace variables via Kustomize? I simply want to use a different ACCOUNT_ID and IAM_ROLE_NAME for each overlay.</p>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::${ACCOUNT_ID}:role/${IAM_ROLE_NAME}
</code></pre>
<p>Thanks in ... | cosmos-1905-14 | <p>Kustomize doesn't use "variables". The way you would typically handle this is by patching the annotation in an overlay. That is, you might start with a base directory that looks like:</p>
<pre><code>base
├── kustomization.yaml
└── serviceaccount.yaml
</code></pre>
<p>Where <code>serviceaccount.yaml</code> ... | larsks |
<p>The field <code>employeeData</code> is of type <code>json</code>.</p>
<p>Consider the query:</p>
<pre><code>select * FROM "employees" where employeeData::text like '%someSampleHere%'
</code></pre>
<p>When I'm running the query inside Postgres it works perfect and I get the rows that I'm asking for.</p>
<p>... | JAN | <p>Sounds like a quoting problem to me. You neglected to show your actual <code>kubectl</code> command line in your question, but this works for me without any errors:</p>
<pre><code>kubectl exec postgres-pod -- psql -U postgres -d employees_db \
-c "select * from \"employees\" where employeeData::text... | larsks |
<p>We have several services running in OpenShift Cluster. Each service is exposed with a route.</p>
<p>For each route we are creating a SSL Certificate. Problem is around managing Certificate expiry for these many routes</p>
<p>One way to solve this problem is to update the Cluster level cert with WildCard domain entri... | user804401 | <p>We use <a href="https://cert-manager.io" rel="nofollow noreferrer">cert-manager</a> to manage certificate generation and renewal. To get cert-manager to inter-operate with OpenShift routes, you need to create <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress... | larsks |
<p>I am trying to get yaml for the particular storage class using Kubernetes python client, following code does the job:</p>
<pre><code>list_storage_class = v1.list_storage_class(_preload_content=False)
storageclass = list_storage_class.read().decode('utf-8') # <class 'urllib3.response.HTTPResponse'>
print(json.d... | l00p | <p>Take a look at the <a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/StorageV1Api.md" rel="nofollow noreferrer"><code>StorageV1API</code></a> documentation. To get a single <code>StorageClass</code>, you want the <code>read_storage_class</code> method:</p>
<pre><code>>>> from ... | larsks |
<p>What is the port opened by kube-proxy for,Why does it listen on so many ports?
From my node, I can see that kube-proxy is listening to a lot of ports. Can someone explain to me why they are listening to so many ports and what is it for?
the output like below:</p>
<pre><code>[root@runsdata-test-0001 ~]# netstat -ant... | Esc | <p>Based on the <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/" rel="nofollow noreferrer">official documentation</a>:</p>
<blockquote>
<p>kube-proxy reflects services as defined in the Kubernetes API on each node and can do simple TCP, UDP, and SCTP stream forwarding or round ... | Farcaller |
<p>I wish to use <code>promtool</code> to run unit tests against alerts that I have setup e.g.</p>
<pre><code>promtool test rules alert-test.yaml
</code></pre>
<p>Here's an example test file:</p>
<pre><code># alert-test.yaml
rule_files:
- 'my-alert.yaml'
tests:
- name: 'Fire ManyRequests Alert'
interval: 1s # every ... | Erich Shan | <blockquote>
<p>what can i do to get this working?</p>
</blockquote>
<p>Just extract the relevant portion of the YAML manifest:</p>
<pre><code>yq .spec my-alert.yaml > my-alert-for-testing.yaml
</code></pre>
<p>And modify your test file to reference the extracted file:</p>
<pre><code>rules_files:
- my-alert-for-te... | larsks |
<p>I am trying to print out the kubernetes version and client version with Ansible however the output comes with slashes and how can I remove the brackets for a more cleaner output?</p>
<pre><code>- name: Kubernetes version
run_once: true
changed_when: False
shell: |
kubectl version
delegate_to: localhost
... | user3270211 | <p>I'm replacing my original answer, because I was forgetting that
<code>kubectl version</code> can produce JSON output for us, which makes this
much easier.</p>
<p>By taking the output of <code>kubectl version -o json</code> and passing it
through the <code>from_json</code> filter, we can create an Ansible dictionary
... | larsks |
<p>I have worked with Jenkins X which is Jenkins running in Kubernetes cluster and I am seeing a new feature in the <a href="https://marketplace.gcr.io/google/jenkins" rel="nofollow noreferrer">Google Cloud marketplace here</a>, which is offering Jenkins, are these same? </p>
| Rajib Mitra | <p>The Jenkins currently available in Google Cloud Marketplace is for the Jenkins Server.
Jenkins X is a new project, that is utilizing Kubernetes and ecosystem to provider a Kubernetes native equivalent to the Jenkins server, and provide horizontal scaling with no single point of failure and small footprint.</p>
| Rob Davies |
<p>I am trying to kill a container using client-go and <a href="https://github.com/kubernetes-sigs/e2e-framework/blob/1af0fd64ebd2474f40cbb1a29c8997ed56aba89d/klient/k8s/resources/resources.go#L293" rel="nofollow noreferrer">e2e</a> framework in Golang but not able to do it successfully.
Example of the full implementat... | Aryaman | <p>Your first attempt looks okay at first glance, although I don't see an <code>ExecInPod</code> method in the <code>client-go</code> package. Because you haven't provided a reproducible example I haven't tried building and running your code.</p>
<p>There's no guarantee that the <code>kill</code> command is available i... | larsks |
<p>I have a executed <code>command1 | command2</code> which runs from inside a container.</p>
<p>I am trying to run the same command by passing it to the running container, but it doesn't work.
I tried <code>kubectl -n namespace exec -it pod -- 'command1 | command2'</code></p>
<p>Any ideas? If pipes are not supported... | USR | <p>The arguments to the <code>kubectl exec</code> command are executed directly, without a shell. Because you're passing not a single command but a shell expression, this isn't going to work.</p>
<p>The solution is to explicitly invoke the shell:</p>
<pre><code>kubectl -n namespace exec -it pod -- sh -c 'command1 | com... | larsks |
<p>I have created a K8 service account token using following command;</p>
<pre><code>kubectl create serviceaccount test-sat-account
</code></pre>
<p>I have deployment yaml for a dotnet service and I am importing the above token in a volume as below;</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
name: ... | Abhijit | <p>Arrange for the token to be stored in a Secret resource:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Secret
metadata:
name: test-sat-account-token
annotations:
kubernetes.io/service-account.name: test-sat-account
type: kubernetes.io/service-account-token
</code></pre>
<p>Now, u... | larsks |
<p>I have a configmap.yaml file as below :</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
name: abc
namespace: monitoring
labels:
app: abc
version: 0.17.0
data:
application.yml: |-
myjava:
security:
enabled: true
abc:
server:
access-log:
enabled: $... | ankur-AJ | <blockquote>
<p>Is that possible in kubernetes configmap to reference with in data section pod's environment variable</p>
</blockquote>
<p>That's not possible. A <code>ConfigMap</code> is not associated with a particular pod, so there's no way to perform the sort of variable substitution you're asking about. You would ... | larsks |
<p>I have a pod which I want to insert the following annotation for:</p>
<pre><code>annotationexample: |
[
{
"a": "b",
"c": "d",
"e": [
"f"
]
}
]
</code></pre>
<p>When I try to app... | Sabo Boz | <p>It sounds like you have an error in your command line. If you want to set that annotation on a resource, you would run a command like this:</p>
<pre><code>kubectl annotate pod/example annotationexample='[
{
"a": "b",
"c": "d",
"e": [
"f"... | larsks |
<p>I have been using following snippet to manage kubernetes auto scaling with terraform</p>
<pre><code>resource "helm_release" "cluster-autoscaler" {
depends_on = [
module.eks
]
name = "cluster-autoscaler"
namespace = local.k8s_service_account_namespace
re... | CuriousMind | <p>I had to do couple of changes to terraform scripts (not sure whey they were not required earlier).</p>
<ul>
<li><p>Added helm to required_providers section</p>
<p>helm = {
source = "hashicorp/helm"
version = "2.3.0"
}</p>
</li>
<li><p>Replaced token generation from</p>
<p>exec {
api_version = &q... | CuriousMind |
<p>I've a docker container based ReactJS based app, a shell script is defined in docker image as the ENTRYPOINT, and I'm able to use docker run image-name successfully.</p>
<p>Now the task is to use this docker image for Kubernetes deployment using standard deployment.yaml file templates, something like following</p>
<... | S N | <p>When you write this in a pod description:</p>
<pre><code> containers:
- name: my-app
imagePullPolicy: Always
image: my-docker-image
command: ["/bin/bash"]
args: ["-c","./entrypoint.sh;while true; do echo hello; sleep 10;done"]
</code></pre>
<p>... | larsks |
<p>I have setup a Postgres pod on my Kubernetes cluster, and I am trying to troubleshoot it a bit.</p>
<p>I would like to use the <a href="https://hub.docker.com/_/postgres" rel="nofollow noreferrer">official Postgres image</a> and deploy it to my Kubernetes cluster using <code>kubectl</code>. Given that my Postgres se... | hotmeatballsoup | <p>If your primarily interested in troubleshooting, then you're probably looking for the <code>kubectl port-forward</code> command, which will expose a container port on your local host. First, you'll need to deploy the Postgres pod; you haven't shown what your pod manifest looks like, so I'm going to assume a <code>D... | larsks |
<p>Now i have Pods as Kubernetes structs wiht the help of the command</p>
<pre><code>pods , err := clientset.CoreV1().Pods("namespace_String").List(context.TODO(), metav1.ListOptions{})
</code></pre>
<p>now i do i get it as individual yaml files
which command should i use</p>
<pre><code>for i , pod := range p... | Pradeep Padmanaban C | <p>The <code>yaml</code> is just a representation of the Pod object in the kubernetes internal storage in etcd. With your <code>client-go</code> what you have got is the <code>Pod</code> instance, of the type <code>v1.Pod</code>. So you should be able to work with this object itself and get whatever you want, for examp... | Sankar |
<p>Cron template</p>
<pre><code>kind: CronJob
metadata:
name: some-example
namespace: some-example
spec:
schedule: "* 12 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: some-example
image: gcr.io/some-example/some-example
imag... | Rahul Sharma | <p>That would be pretty trivial with <code>yq</code> and a shell script. Assuming
your template is in <code>cronjob.yml</code>, we can write something like this:</p>
<pre><code>let count=0
while read url; do
yq -y '
.metadata.name = "some-example-'"$count"'"|
.spec.jobTemplate.spec.templat... | larsks |
<p>I need to view logs a pod of specific name:
Basically, I want to see logs for the pod having name <code>infra</code> in it.</p>
<p>I'm using below command:</p>
<pre><code>kubectl logs $(kubectl get pods | awk '{print $1}' | grep -e "infra")
</code></pre>
<p>But, it's not working.</p>
| Temp Expt | <p>The <a href="https://github.com/stern/stern" rel="nofollow noreferrer"><code>stern</code></a> command make this very simple:</p>
<pre><code>stern infra
</code></pre>
<p>That will stream the logs from any pods that have <code>infra</code> in the name.</p>
<hr />
<p>But even without <code>stern</code>, you can do some... | larsks |
<p>I'm trying to expose a SignalR hub hosted in a Kubernetes (Azure) pod. Basically, the authentication and the handshake steps work fine, but when I trigger some action, all clients connected via the k8s Ingress doesn't receive the message. Has anybody experienced this issue or just have shared SignalR hubs through Ku... | Alvaro Inckot | <p>Try: </p>
<pre><code>annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/affinity: cookie
nginx.ingress.kubernetes.io/session-cookie-hash: sha1
nginx.ingress.kubernetes.io/session-cookie-name: REALTIMESERVERID
</code></pre... | Denis Biondic |
<p>I'm looking for a way to restart all the pods of my service. They should restart one by one so the service is always available. The restart should happen when a Python script from a different service is done. </p>
<p>I'm doing this because on the pods I want to restart there is a Gunicorn-server running which needs... | Florian | <p><code>kubectl rollout restart</code> has landed in Kubernetes v1.15 [1]. This feature is designed for exactly what you are looking to do - a rolling restart of pods.</p>
<p>[1] <a href="https://github.com/kubernetes/kubernetes/issues/13488" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/1... | vishal |
<p>I'm running prometheus and grafana under k3s, accessible (respectively) at <a href="http://monitoring.internal/prometheus" rel="nofollow noreferrer">http://monitoring.internal/prometheus</a> and <a href="http://monitoring.internal/grafana" rel="nofollow noreferrer">http://monitoring.internal/grafana</a>. The grafana... | larsks | <p>Since I haven't been able to figure out traefik yet, I thought I'd post my solution here in case anyone else runs into the same situation. I am hoping someone comes along who knows The Right Way to to do this, and if I figure out I'll update this answer.</p>
<p>I added a new deployment that runs <a href="https://git... | larsks |
<p>The HPA docs at <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/</a> provide two examples of the <code>selector</code> property, one for the pod and the oth... | Phyxx | <p>It turns out the selector has to be a map, or you get the following error:</p>
<pre><code>error: error validating "customresource.yml": error validating data: ValidationError(HorizontalPodAutoscaler.spec.metrics[0].object.metric.selector): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector... | Phyxx |
<p>we have kubernetes deployment controller build using kubebuilder.
in controller we are updating ConfigMap in controller and then want all pods backed by deployment to restart so latest ConfigMap will be reloaded.</p>
<p>How can I trigger this deployment/pods restart from controller.</p>
<p>Note: the deployment/pod I... | Vikas Budhwat | <p>You can't "restart" a Pod, but if the Pod is managed by a Deployment you can remove the Pod and the Deployment will spawn a new one. If you update the Deployment (e.g., by changing the name of a ConfigMap referenced in the manifest), the Deployment will automatically respawn all associated pods.</p>
<p>You... | larsks |
<p>If a Helm deployment's status is <code>failed</code>, what can I do to determine what made it fail?</p>
| Nomnom | <p><code>helm history <release_name></code></p>
<p>Shows the kubernetes errors for the attempted deployment of that release.</p>
| 70Mike |
<p>I have added a map in my values.yaml file like below</p>
<pre><code>defaultview:
journey:
ce5f164c-ae0f-11e7-9220-c7137b83fb6a: 45
abc: -1
pqr: 30
</code></pre>
<p>I read this property in configmap like below</p>
<pre><code>defaultview.journey: {{ .Values.defaultview.journey }}
</code></pre>
<p>When I ... | Prashant Raghav | <p>This line is problematic:</p>
<pre><code>defaultview.journey: {{ .Values.defaultview.journey }}
</code></pre>
<p>You're trying to include a structured variable as a simple string, so this is resulting in a ConfigMap that looks like:</p>
<pre><code>data:
defaultview.journey_broken: map[abc:-1 ce5f164c-ae0f-11e7-922... | larsks |
<p>In my machines , 4 pvc are created. Now i need to get all volume name associated with the pvc in a list. Then those list will be passed to storage array and i will ensure that the volumes are created in storage server. </p>
<pre><code>- name: Verify whether the PVC is created
command: "kubectl get pvc pvc{{loca... | Samselvaprabu | <p>Your <code>set_fact</code> task is setting <code>volume_name</code> to a single value in each iteration...so of course, when the loop completes, the variable has the value from the final iteration. That's the expected behavior. If you want a list, you need to create a list. You can do this by <em>appending</em> to... | larsks |
<p>I've decided to run a podTemplate with one container of main.</p>
<ol>
<li>Why does my pod template configuration include JNLP? What is needed for? can I have only my pod with my container with my image?</li>
<li>How do I overwrite the JNLP image with my image instead of inbound image?</li>
<li>How do I run my job o... | EilonA | <p>The kubernetes plugin has a summary of what the JNLP is used for. It's recommended to retain the JNLP container, and the name is JNLP mostly for historical reasons. It sounds like it's not JWS.</p>
<blockquote>
<p>The Kubernetes plugin allocates Jenkins agents in Kubernetes pods. Within these pods, there is always... | chubbsondubs |
<p>Kubernetes kind <code>Deployment</code> doesn't allow patch changes in <code>spec.selector.matchLabels</code>, so any new deployments (managed by Helm or otherwise) that want to change the labels can't use the RollingUpdate feature within a Deployment. What's the best way to achieve a rollout of a new deployment wit... | snugghash | <p>I just did this, and I followed the four-step process you describe. I think the answer is no, there is no better way.</p>
<p>My service was managed by Helm. For that I literally created four merge requests that needed to be rolled out sequentially:</p>
<ol>
<li>Add identical deployment "foo-temp", only nam... | Fletch |
<p>I've been using <code>kubectl -vvvv ...</code> a lot to learn about the different HTTP requests sent to the API server for different commands.</p>
<p>However, I cannot seem to find a way of achieving the same with <code>docker</code>.</p>
<p>In particular, I've considered <code>docker --debug ...</code>, but e.g. <c... | Shuzheng | <blockquote>
<p>How can I make docker output the HTTP requests sent to the daemon?</p>
</blockquote>
<p>You can't, but you can set up a proxy server between the client and the docker daemon so that you can see the requests. The <code>socat</code> tool is useful for this. Set up a proxy by running:</p>
<pre><code>socat ... | larsks |
<p>I'm updating some of my Kubernetes configurations to use <code>'replacements'</code> and <code>'resources'</code> in kustomize as <code>'vars'</code> and <code>'bases'</code> have been deprecated.</p>
<p>Previously, I used <code>'vars'</code> in a base (<code>/base/secrets/</code>) like this:</p>
<pre><code>apiVersi... | unitop | <p>Thanks for updating your question with an example.</p>
<p>The answer I've posted here is still the correct solution in terms of sharing a replacement configuration among multiple overlays, but there are some errors in your <code>replacement</code> syntax: you cannot target <code>spec.template.spec.volumes.name</code... | larsks |
<p>I'm currently using the Kubernetes Plugin for Jenkins to on-demand provision Jenkins workers on my kubernetes cluster. </p>
<p>A base image for the worker node is stored in my (artifactory) docker registry, and the Kubernetes plugin is configured to pull this image to spawn workers.</p>
<p>My artifactory docker re... | Traiano Welcome | <p>the <code>imagePullSecret</code> relates to a Kubernetes secret where your credentials are stored </p>
<p>Details of how to create the Kubernetes can be found here: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">pull image from private regis... | Graeme |
<p>For default service account I have creating clusterrolebinding for cluster role=cluster-admin <br>using below kubectl command</p>
<pre><code>kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=rbac-test:default
</code></pre>
<p>cluster-admin role is bind to default ser... | Anurag_BEHS | <p>When you run your <code>kubectl</code> command it creates the following object:</p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: add-on-cluster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
su... | larsks |
<p>I am new to kustomize and trying to figure out how to patch my ingress that is running via OpenShift Container Platform.</p>
<p>The base config works fine and the overlay was working until I introduced my ingress overlay patch. For reference the patch-service overlay does work so I am pretty sure my structure and li... | Daryl | <p>The error is telling you everything you need to know:</p>
<pre><code>cannot unmarshal number into Go struct field
</code></pre>
<p>First, look at the format of your initial Ingress manifest:</p>
<pre><code>kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: mssql-example-adc
annotations:
ingress.c... | larsks |
<p>I have 2 EKS clusters, in 2 different AWS accounts and with, I might assume, different firewalls (which I don't have access to). The first one (Dev) is all right, however, with the same configuration, UAT cluster pods is struggling to resolve DNS. The Nodes can resolve and seems to be all right.</p>
<p>1) ping 8.8.... | shrimpy | <p>Note that this issue may present itself in many forms (e.g. DNS not resolving is just one possible case). The <code>terraform-awk-eks</code> module exposes a terraform input to create the necessary security group rules that allow these inter worker-group/node-group communications: <code>worker_create_cluster_primary... | fvdnabee |
<p>I am running a load test over a kubernetes pod and i want to sample every 5 minutes the CPU and memory usage of it.
I was currently manually using the linux <code>top</code> command over the kubernetes pod.</p>
<p>Is there any way given a <code>kubernetes pod</code> to fetch the CPU/Memory usage every X minutes and ... | Bercovici Adrian | <p>Try this one-liner:</p>
<pre class="lang-bash prettyprint-override"><code>while [ true ]; do echo $(date) $(date +%s) $(kubectl top -n your-namespace pod $(kubectl get pods -n your-namespace -l your-label-name=your-label-value -o jsonpath='{..metadata.name}') | tail -n 1) | tee -a /path/to/save/your/logs.txt; done
<... | izogfif |
<p>I have been working with one <a href="https://kubectl.docs.kubernetes.io/references/kustomize/builtins/#_patchesjson6902_" rel="nofollow noreferrer"><code>patchesJson6902</code></a> clause in my Kubernetes kustomize configuration; now I want to use overlays (to support different instances) and I want to split the pa... | Christian Fuchs | <p>First: the <code>patchesJson6902</code> directive has been deprecated; you should simply be using <code>patches</code>.</p>
<p>With respect to your question, when you include a base kustomization in the <code>resources</code> section of your <code>kustomization.yaml</code>, kustomize neither knows or cares that the ... | larsks |
<p>When creating an ingress resource in GCE using the Nginx ingress controller, the ingress resource is stuck on "Creating ingress". Any custom annotations appear to be lost, but I can access the URL defined by the ingress.</p>
<p>What could be causing this?</p>
<p><a href="https://i.stack.imgur.com/u3uLe.png" rel="n... | Phyxx | <p>This turned out to be because I was sending the annotation</p>
<pre><code>nginx.ingress.kubernetes.io/ssl-redirect: false
</code></pre>
<p>instead of </p>
<pre><code>nginx.ingress.kubernetes.io/ssl-redirect: "false"
</code></pre>
<p>According to <a href="https://github.com/kubernetes/ingress-nginx/issues/1990" r... | Phyxx |
<p>Trying to access Kubernetes dashboard (Azure AKS) by using below command but getting error as attached.</p>
<pre><code>az aks browse --resource-group rg-name --name aks-cluster-name --listen-port 8851
</code></pre>
<p><a href="https://i.stack.imgur.com/IRLRB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.i... | KRM | <p>Please read AKS documentation of how to authenticate the dashboard from <a href="https://learn.microsoft.com/en-us/azure/aks/kubernetes-dashboard" rel="nofollow noreferrer">link</a>. This also explains about how to enable the addon for newer version of k8s also.</p>
<p>Pasting here for reference</p>
<p><strong>Use a... | Atul |
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
name: echo-job
spec:
template:
metadata:
name: echo
spec:
containers:
- name: echo
image: busybox
command: ['echo', 'Hello Kubernetes Jobs!']
restartPolicy: Never
backoffLimit: 4
</code></pre>
<p>Can someone please... | james gem | <p><code>metadata.name</code> is the name <strong>of the job</strong>.</p>
<p><code>spec.template.metadata.name</code> is the name <strong>of the pod created by the job</strong> (which will also have a random suffix appended).</p>
<p>If I submit your manifest, we see the Job:</p>
<pre><code>$ kubectl get job
NAME ... | larsks |
<p>I need to get node name and IP address of each node and then create dictionary object. I am able to get Kubernetes node list using below command </p>
<pre><code> - hosts: k8s
tasks:
- name: get cluster nodes
shell: "kubectl get nodes -o wide --no-headers | awk '{ print $1 ,$7}'"
register: nodes
... | Samselvaprabu | <p>The first argument to the <code>combine</code> filter must be a dictionary. You're calling:</p>
<pre><code> - set_fact:
node_data: "{{ node_data | combine ( item.split(' ').0 : { 'name': item.split(' ').0 , 'ip' : item.split(' ').1 }, recursive=True) }}"
with_items: "{{ nodes.stdout_lines }}"
</code></pr... | larsks |
<p>I tried to configure envoy in my kubernetes cluster by following this example: <a href="https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/configuration-dynamic-filesystem" rel="nofollow noreferrer">https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/configuration-dynamic-filesystem</a></p>
<p>M... | sschoebinger | <p>I think the answer to your issue is that the filesystem events that Envoy uses to reload its xDS config are not triggered by configmap volumes. <a href="https://github.com/mumoshu/crossover#why-not-use-configmap-volumes" rel="nofollow noreferrer">See more explanation in the README for the crossover utility.</a></p>
| Nick Sieger |
<p>I am using fluentbit as a pod deployment where I am creating many fluentbit pods which are attached to azure blob containers. Since multiple pods exist I tried adding tolerations as I did on daemonset deployment but it did not work and failed. Also every time I delete and start the pods reinvests all the the again. ... | yasin mohammed | <p>The <code>tolerations</code> attribute needs to be set on the pod, but you are attempting to set it on a container (that's why you see the error "unknown field "tolerations" in io.k8s.api.core.v1.Container"). You would need to write:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
name: deplo... | larsks |
<p>I'm trying to mount an <code>azureFile</code> volume on a Windows K8S pod, but I get the error </p>
<blockquote>
<p>MountVolume.SetUp failed for volume "azure-file-share" : azureMount:
SmbGlobalMapping failed: fork/exec
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe: The
parameter is incorrect., ... | Phyxx | <p>The issue where was a bad <code>azurestorageaccountkey</code> value in the secret. You can have a secret like:</p>
<pre><code>apiVersion: v1
kind: Secret
metadata:
name: volume-azurefile-storage-secret
type: Opaque
data:
azurestorageaccountname: <base 64 encoded account name>
azurestorageaccountkey: <... | Phyxx |
<p>I have a local minikube cluster on hyper-v, when i try to pull images from my private repository i get this error :</p>
<p><em>Failed to pull image "my-repolink/image": rpc error: code = Unknown desc = Error response from daemon: Get my-repolink/v2/: x509: certificate signed by unknown authority</em></p>
<p>When r... | M__ | <p>You need to tell minikube which certificates to trust. The <a href="https://minikube.sigs.k8s.io/docs/reference/networking/proxy/#x509-certificate-signed-by-unknown-authority" rel="nofollow noreferrer">official doc</a> mentions this specific issue.</p>
<p>The suggestion is to put the appropriate self-signed ceritif... | Farcaller |
<p>I want all members of security group <code>sg-a</code> to be able to access several ports, e.g. 6443 (kubernetes api server), on all instances in <code>sg-a</code>: including themselves. </p>
<p>I create a rule in <code>sg-a</code> that says</p>
<ul>
<li>Type: Custom TCP</li>
<li>Protocol: TCP</li>
<li>Port Range:... | MCI | <p>For the security group to operate as you describe, the instances will need to connect to each other via a <strong>Private IP address</strong>.</p>
<p>The fact that it works if you allow the Public IP address indicates that the connection is being made by the public IP address.</p>
| John Rotenstein |
<p>I have KeyCloak Gateway running successfully locally providing Google OIDC authentication for the Kubernetes dashboard. However using the same settings results in an error when the app is deployed as a pod in the cluster itself.</p>
<p>The error I see when the Gateway is running in a K8S pod is:</p>
<pre><code>una... | Phyxx | <p>This turned out to be a copy/paste fail in the end, with the client secret being incorrect. The error message wasn't much help here, but at least it was a simple fix.</p>
| Phyxx |
<p>I'm deploying a pod written in quarkus in kubernetes and the startup seems to go fine. But there's a problem with readiness and liveness that result unhealthy.
For metrics I'm using smallrye metrics configured on port 8080 and on path:</p>
<pre><code>quarkus.smallrye-metrics.path=/metrics
</code></pre>
<p>If i enter... | Giamma | <p>First I needed to fix dockerfile.jvm</p>
<pre><code>FROM openjdk:11
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
# We make four distinct layers so if there are application changes the library layers can be re-used
# RUN ls -la target
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 target/... | ozkanpakdil |
<p>I have deployed kibana in a kubernetes environment. If I give that a LoadBalancer type Service, I could access it fine. However, when I try to access the same via a nginx-ingress it fails. The configuration that I use in my nginx ingress is:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
an... | Sankar | <p>I have found the cause of the error. The <code>vendors.bundle.js</code> file was relatively bigger and since I was accessing from a relatively slow network, the requests were terminated. The way I fixed this is, by adding to the nginx-ingress configuration the following fields:</p>
<pre><code>nginx.ingress.kubernet... | Sankar |
<p>I want to add an initContainer to all of my pods (with a specific annotation) in my kustomize base. The newly added init container should be the first init container. My patch looks like this.</p>
<pre><code>patches:
- target:
kind: Pod
annotationSelector: "database_init=True"
patch: |-
... | briconaut | <p>JSONPatch patches in general are fundamentally unable to handle the "append to existing list or create new list" situation. See e.g. <a href="https://stackoverflow.com/q/47670366/147356">this question</a>.</p>
<p>Fortunately, with Kustomize 5.0.1 it appears to be possible to achieve your goal using a strat... | larsks |
<p>I have created an pub/sub topic to which I will publish a message every time an new object is uploaded to the bucket. Now I want to create a subscription to push a notification to an endpoint every time a new object is uploaded to that bucket. Following the documentation, I wanted something like that:</p>
<p><code>... | gr7 | <p>Yeah, so as @jakub-bujny points out you need a SSL endpoint. So one solution, on GKE, to use <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/managed-certs" rel="nofollow noreferrer">google's managed certificates</a> with an Ingress resource (link shows you how)</p>
| CpILL |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.