Question
stringlengths
65
39.6k
QuestionAuthor
stringlengths
3
30
Answer
stringlengths
38
29.1k
AnswerAuthor
stringlengths
3
30
<p>I am trying to deploy <code>Postgresql</code> through helm on <code>microk8s</code>, but pod keeps pending showing <code>pod has unbound immediate PersistentVolumeClaims</code> error.</p> <p>I tried creating <code>pvc</code> and a <code>storageclass</code> inside it, and editing it but all keeps pending. </p> <p>D...
Mohammad Hussein
<blockquote> <p>on the 'PVC' it shows 'no persistent volumes available for this claim and no storage class is set' Error</p> </blockquote> <p>This means that you have to prepare PersistentVolumes for your platform that can be used by your PersistentVolumeClaims (e.g. with correct StorageClass or other requirements)<...
Jonas
<p>I have a PersistenceVolumeClaim defined by</p> <pre><code>apiVersion: v1 kind: PersistentVolumeClaim metadata: name: my-pvc spec: storageClassName: &quot;standard&quot; accessModes: - ReadWriteOnce resources: requests: storage: 1Gi </code></pre> <p>And the containers section of the deployment y...
Jon
<blockquote> <p>Do each replica of my pod get 1GB storage space (Assuming the PersistentVolume has enough space)?</p> </blockquote> <p>No. Since you use one <code>PersistentVolumeClaim</code>, you will get one <code>PersistentVolume</code>.</p> <blockquote> <p>How would this behave if the pod replicas are on different ...
Jonas
<p>I was going through in depth of K8s volumes and one of the concept messed me up. It would be great if someone could explain me this. These are the modes in K8s volumes.</p> <p>ReadWriteOnce -- the volume can be mounted as read-write by a single node</p> <p>ReadOnlyMany -- the volume can be mounted read-only by many ...
Aditya Malviya
<blockquote> <p>What if I run two mysql pods on same node and the node is ReadWriteOnce ? How my both pods will write?</p> </blockquote> <p>If you run two DBMS systems (e.g. MySQL or PostgreSQL) in Pods, they are both independent and they should have <strong>two independent PersistentVolumeClaims</strong>. Only run sin...
Jonas
<p>When I am using below it deletes the running POD after matching the pattern from commandline: </p> <pre><code>kubectl get pods -n bi-dev --no-headers=true | awk '/group-react/{print $1}' | xargs kubectl delete -n bi-dev pod </code></pre> <p>However when I am using this command as an alias in .bash_profile it doesn...
pauldx
<blockquote> <p>Am I missing something to delete POD using Pattern Match or with Wilcard?</p> </blockquote> <p>When using Kubernetes it is more common to use <em>labels</em> and <em>selectors</em>. E.g. if you deployed an application, you usually set a label on the pods e.g. <code>app=my-app</code> and you can then ...
Jonas
<p>I'm working on a website based in Google's Kubernetes</p> <p>Our system has a workload that is for our main website. Right now I have an uptime alert that will send me an text/email.</p> <p>Under some very rare circumstances, the site will go down and the only way to fix this is to delete the pod that the web servic...
Justin Lloyd
<blockquote> <p>I would like this to be automated. Is there a way to configure something like this? Some process that, if there is an uptime alert failure, it'll automatically delete the web service pod(s) so that they recreate themselves?</p> </blockquote> <p>If Kubernetes can detect this situation, you can use a <a h...
Jonas
<p>I have a single master cluster with 3 worker nodes. The master node has one network interface of 10Gb capacity and all worker nodes have a 40Gb interface. They are all connected via a switch.</p> <p>I'd like to know if this might create a bottleneck if the data between nodes have to pass through the master node?</p>...
Muzammil
<blockquote> <p>For instance, a pod in node1 sends data to a pod in node2, does the traffic go through the master node?</p> </blockquote> <p>No. Kubernetes is designed with a flat network model. If Pod on node A send a request to Pod on node B, the inter-node traffic is directly from node A to node B as they are on the...
Jonas
<p>We are using secret as environment variables on pod, but every time we have updated on secrets, we are redeploying the pods to take changes effect. We are looking for a mechanism where Pods get restarted automatically whenever secrets gets updated. Any help on this?</p> <p>Thanks in advance.</p>
ramesh reddy
<p>There are many ways to handle this.</p> <p>First, use <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="noreferrer">Deployment</a> instead of &quot;naked&quot; Pods that are not managed. The Deployment will create new Pods for you, when the Pod template is changed.</p> <p>Second, t...
Jonas
<p>I just started researching Kubernetes. I have 2 Windows VM on hyper-v. One is a SQL server and one is an application server with a .net application. How can I migrate my SQL and APP servers to Kubernetes in an architecture so that applications can continue to run at the time of failover or down.</p> <p>Thanks.</p>
ufukcam
<blockquote> <p>in an architecture so that applications can continue to run at the time of failover or down.</p> </blockquote> <p>To achieve this, you need to make sure that you don't have any single point of failure. Kubernetes is well architected for this kind of workload.</p> <blockquote> <p>an application server wi...
Jonas
<p>We have a micro-services java applications, as and when we have changes in code we have to perform the kubernetes deployment.</p> <p>How will I apply the latest changes to the deployment with the same Image name</p> <p>we have a single replica and when I execute <code>kubectl apply -f deployment.yaml</code> it say...
magic
<p>This has been discussed in <a href="https://github.com/kubernetes/kubernetes/issues/33664" rel="nofollow noreferrer">#33664</a></p> <blockquote> <p>using :latest tag IMO is not the best practice as it's hard to track what image is really in use in your pod. I think tagging images by versions or using the digests ...
Jonas
<p>When I check the definition of &quot;WebhookClientConfig&quot; of API of Kubernetes I found comments like this:</p> <pre><code>// `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. // If unspecified, system trust roots on the apiserver are used. // +optional CABund...
vincent pli
<p>It is a good practice to use secure network connections. A Webhook-endpoint in Kubernetes is typically an endpoint in a private network. A custom private CABundle can be used to generate the TLS certificate to achieve a secure <a href="https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-cont...
Jonas
<p>If I have a deployment with only a single replica defined, can I ensure that only ever one pod is running?</p> <p>I noticed that when I do something like <code>kubectl rollout</code> for a very short amount of time I will see two pods in my logs.</p>
trallnag
<blockquote> <p>If I have a deployment with only a single replica defined, can I ensure that only ever one pod is running?</p> </blockquote> <p>It sounds like you are asking for &quot;at most one Pod&quot; semantics. Also consider what happens when a Node becomes <em>unresponsive</em>.</p> <p>This is point where <a hre...
Jonas
<p>I am exploring different strategies for handling shutdown gracefully in case of deployment/crash. I am using the Spring Boot framework and Kubernetes. In a few of the services, we have tasks that can take around 10-20 minutes(data processing, large report generation). How to handle pod termination in these cases whe...
Shivam Singh
<blockquote> <p>we have tasks that can take around 10-20 minutes(data processing, large report generation)</p> </blockquote> <p>First, this is more of a <em>Job/Task</em> rather than a <em>microservice</em>. But similar &quot;rules&quot; applies, the node where this job is executing might terminate for upgrade or other...
Jonas
<p>I have 2 API backends Microservices in which each Microservice has MongoDB database. I want to deploy 2 or more instances of each of these in Kubernetes cluster on Cloud provider such as AWS.</p> <p>Each instance of Microservice runs as a container in a Pod. Is it possible to deploy MongoDB as another container in t...
ace
<blockquote> <p>Each instance of Microservice runs as a container in a Pod. Is it possible to deploy MongoDB as another container in the same Pod?</p> </blockquote> <p>Nope, then your data would be gone when you upgrade your application.</p> <blockquote> <p>Or what is the best practice for this use case?</p> </blockquo...
Jonas
<p>I am trying to setup Kubernetes for my company. I have looked a good amount into Jenkins X and, while I really like the roadmap, I have come the realization that it is likely not mature enough for my company to use at this time. (<a href="https://docs.cloudbees.com/docs/cloudbees-jenkins-x-distribution/latest/user...
Vaccano
<blockquote> <p>I mean something similar to what Jenkins X supports. (Meaning changes to the cluster stored in a Git repository. And merging causes a deployment.)</p> </blockquote> <p>Yes, this is the what Jenkins (or other CICD tools) do. You can declare a deployment pipeline in a <a href="https://jenkins.io/doc/bo...
Jonas
<p>I am testing stateful sets with replicas, is there a way to force a service on each replica? For example, if I refer to the following note:</p> <p><a href="https://itnext.io/introduction-to-stateful-services-kubernetes-6018fd99338d" rel="nofollow noreferrer">https://itnext.io/introduction-to-stateful-services-kubern...
drifter
<p>You can access the pods directly, or you can create headless services as you write. This headless service is not created automatically, it is up to you to create it.</p> <blockquote> <p>you are responsible for creating the Headless Service responsible for the network identity of the pods.</p> </blockquote> <p>From <...
Jonas
<p>I've created a simple K8s deployment with the <code>kubectl create</code> command</p> <pre><code>kubectl create -f k8-deployment.yaml </code></pre> <p>My <code>k8-deployment.yaml</code> file looks like this</p> <pre><code>apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: mag...
Alana Storm
<p>You can do this in two ways. Either <em>imperative</em> - a quick command Or <em>declarative</em> - good for a production environment where you store your Deployment-manifest in Git.</p> <p><strong>Imperative way</strong>: (this will then diverge from what you have in your yaml-file)</p> <pre><code>kubectl scale dep...
Jonas
<p>I have a service that has single thread writer with multiple thread reader to a file deployed on k8. Now I want to take advantage of the k8 persistent storage to save the huge load time in between pod restarts, by moving the file (1 writer, multi reader) to k8 persistent storage with local storage type. How would th...
Yituo
<blockquote> <p>by moving the file (1 writer, multi reader) to k8 persistent storage with local storage type. How would this affect my file lock?</p> </blockquote> <p>In both cases the application interacts with the <strong><em>file on the filesystem</em></strong>. So there will be no logical difference for your applic...
Jonas
<p>I'm running a kubernetes cluster of 20+ nodes. And one pod in a namespace got restarted. The pod got killed due to OOM with exit code 137 and restarted again as expected. But would like to know the node in which the pod was running earlier. Any place we could check the logs for the info? Like tiller, kubelet, kubepr...
vijay v
<blockquote> <p>But would like to know the node in which the pod was running earlier.</p> </blockquote> <p>If a pod is killed with <code>ExitCode: 137</code>, e.g. when it used more memory than its limit, it will be restarted on the same node - not re-scheduled. For this, check your metrics or container logs.</p> <p>Bu...
Jonas
<p>Let's say I have a web application Backend that I want to deploy with the help of Kubernetes, how exactly does scaling work in this case.</p> <p>I understand scaling in Kubernetes as: We have one a master node that orchestrates multiple worker nodes where each of the worker nodes runs 0-n different containers with t...
jonithani123
<blockquote> <p>Does the request reach the master node which then handles this problem internally?</p> </blockquote> <p>No, the master nodes does not handle traffic for your apps. Typically traffic meant for your apps arrive to a load balancer or gateway, e.g. <a href="https://cloud.google.com/load-balancing" rel="nofo...
Jonas
<p>I am looking to write to a file on a Kubernetes pod through Elixir code. The pod starts off when exec'ing in at /opt/app and I want to write a file to some path like /opt/app/file_tmp.</p> <p>Currently I am hard coding in the file writing the string &quot;/opt/app/&quot; and was wondering if there is a better way to...
William Ross
<blockquote> <p>wondering if there is a better way to get the Kubernetes home directory so I don't need to hard code this string within the application?</p> </blockquote> <p>Kubernetes is the container orchestrator. Your app runs in a container with its filesystem. You set the &quot;working directory&quot; in your Dock...
Jonas
<p>This is just a general question about microservice architecture. Why do 2 or more internal services still need token auth like oauth2 to communicate with each other if the outside world doesn't have access to them? Couldn't their apis just filter internal IP addresses instead? What are the risks with that approach?<...
u84six
<blockquote> <p>Why do 2 or more internal services still need token auth like oauth2 to communicate with each other if the outside world doesn't have access to them?</p> </blockquote> <p>You don't <em>need</em> OAuth2 or token authentication, but you <em>should</em> use it. It depends on how much you <em>trust</em> ...
Jonas
<p>I am quite new to Tekton.</p> <p>I am facing an issue currently - replication of pods using tekton.</p> <p>What I want to achieve?</p> <ul> <li>I want to create a pipeline with two tasks.</li> <li>First task creates an echo hello pod</li> <li>Second task creates an echo goodbye pod.</li> <li>Both pods needs to have ...
Shresth Suman
<p>There is no such thing as &quot;replicas&quot; in Tekton Pipelines.</p> <p>A Tekton Pipeline is a pipeline of Tasks that execute in a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="nofollow noreferrer"><em>directed acyclic graph</em></a>.</p>
Jonas
<p>What is the correct way of memory handling in OpenShift/Kubernetes?</p> <p>If I create a project in OKD, how can I determine optimal memory usage of pods? For example, if I use 1 deployment for 1-2 pods and each pod uses 300-500 Mb of RAM - Spring Boot apps. So technically, 20 pods uses around 6-10GB RAM, but as I s...
tarcali
<blockquote> <p>Is it able to give extra memory but only for the first X minutes for each pod start?</p> </blockquote> <p>You do get this behavior when you set the <strong>limit</strong> to a higher value than the <strong>request</strong>. This allows pods to burst, unless they all need the memory at the same time.</p>...
Jonas
<p>I am writing an ansible playbook right now that deploys a dockerized application in kubernetes. However, for molecularity purposes I would rather not hard code the files that need to be apply after doing <code>kompose convert -f docker-compose.yaml --volumes hostPath</code> Is there a way to apply all the files in...
James Ukilin
<p>You can apply all files in a folder with</p> <pre><code>kubectl apply -f &lt;folder&gt; </code></pre> <p>You may also be interested in <em>parameterization</em> of your manifest files using <a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/" rel="noreferrer">Kustomize</a> e.g. use ...
Jonas
<p>I am trying to create a cli tool for kubernetes. I need to generate Bearer Token for communicating with kubernetes API. How can I generate the token from Kubeconfig File? I do not want to use external library or kubectl.<br><br> Here is example Kubeconfig File:</p> <pre><code>apiVersion: v1 clusters: - cluster: ...
anilkuscu
<blockquote> <p>I need to generate Bearer Token for communicating with kubernetes API</p> </blockquote> <p>You cannot ”generate” these tokens. They are <em>issued</em> by the control plane and signed with the <em>private key</em> that the control plane holds. It would be a security hole if you could generate these on t...
Jonas
<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>
james pow
<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>
Jonas
<p>I am trying to run my Intellij Scala project in the cloud using GCP. I am currently trying to use Kubernetes but I am following <a href="https://cloud.google.com/kubernetes-engine/docs/quickstarts/deploy-app-container-image" rel="nofollow noreferrer">this tutorial</a> and am not finding any support for Scala. How wo...
Elias Fizesan
<blockquote> <p>I am currently trying to use Kubernetes</p> </blockquote> <p>You deploy docker containers to Kubernetes.</p> <blockquote> <p>I am following this tutorial and am not finding any support for Scala.</p> </blockquote> <p>You can use any language in a docker container. In the link, only some example apps is ...
Jonas
<p>Currently I am using <code>Jenkins on kubernetes</code> and wanted to migrate to <code>tekton</code> because trying achieve CI steps as a code (similar to Helm chart for CD steps). Just wondering about Tekton architecture -</p> <p>why every task creates different pod rather than creating different containers in a si...
Ashish Kumar
<blockquote> <p>Just wondering about Tekton architecture - why every task creates different pod rather than creating different containers in a single pod?</p> </blockquote> <p>This is a design choice that was made early in the project. They want <em>Tasks</em> to be a reusable component with, e.g. parameters and result...
Jonas
<p>I have scenario when my cluster consist of two microservices.</p> <p>In service <strong>A</strong> i have .CSV(15MB) file, which also is needed in service <strong>B</strong>.</p> <p>I don't want to place this file two times in each repo.</p> <p>During deployment of service <strong>A</strong> I want to place this .cs...
novja
<p>The easiest solution would be to build the file into the docker image.</p>
Jonas
<p>I have 2 Deployment - A(1 replica) and B(4 replica)</p> <p>I have scheduled job in the POD A and on successful completion it hits endpoint present in one of the Pods from Deployment B through the service for Deployment B.</p> <p>Is there a way I can hit all the endpoints of 4 PODS from Deployment B on successful...
Arpan Sharma
<blockquote> <p>Is there a way I can hit all the endpoints of 4 PODS from Deployment B on successful completion of job?</p> <p>But is this possible as I don't want to use pub-sub for this.</p> </blockquote> <p>As you say, a pub-sub solution is best for this problem. But you don't want to use it.</p> <p><strong>Use stab...
Jonas
<p>I created below statfulset on microk8s:</p> <pre><code>apiVersion: apps/v1 kind: StatefulSet metadata: name: postgresql13 spec: selector: matchLabels: app: postgresql13 serviceName: postgresql13 replicas: 1 template: metadata: labels: app: postgresql13 spec: container...
frisky5
<blockquote> <p>Isn't is supposed to not use more than what the PVC have?</p> </blockquote> <p>This is a misunderstanding. What you specify in a <strong>resource request</strong> is the resources your application <em>needs at least</em>. You might get more. You typically use <strong>resource limits</strong> to set hard...
Jonas
<p>I'm playing around with kubernetes ConfigMaps. In the <a href="https://kubernetes.io/docs/concepts/configuration/configmap/#configmaps-and-pods" rel="nofollow noreferrer">official documentation</a>, I see &quot;file-like keys&quot; in the <code>data</code> field:</p> <pre><code>apiVersion: v1 kind: ConfigMap metadat...
Johnny Metz
<blockquote> <ul> <li>Proper syntax highlighting for the &quot;file-like&quot; configurations</li> <li>Can run auto formatters against the &quot;file-like&quot; configurations</li> </ul> </blockquote> <p>Yes, it is easier to save the files as proper files on your machine and in Git.</p> <p>I propose that you use the <a...
Jonas
<p>I would like to run a single pod of Mongo db in my Kubernetes cluster. I would be using node selector to get the pod scheduled on a specific node.</p> <p>Since Mongo is a database and I am using node selector, is there any reason for me not to use Kubernetes Deployment over StatefulSet? Elaborate more on this if we ...
RamPrakash
<blockquote> <p>Since mongo is a database and I am using node selector, Is there any reason for me not to use k8s deployment over StatefulSet? Elaborate more on this if we should never use Deployment.</p> </blockquote> <p>You should not run a database (or other stateful workload) as <code>Deployment</code>, use <code>S...
Jonas
<p>I have a pod that is defined by a deployment, and the yaml definition is stored in my codebase. There are time when I'd like to have a volume mount configured for the pod/container, so it would be great to have a script that could enable this. I know I can use <code>kubectl edit</code> to open up an editor and do th...
s g
<p>Use <a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/" rel="nofollow noreferrer">Declarative Management of Kubernetes Objects Using Kustomize</a>. You already have a <code>deployment.yaml</code> manifest in your codebase. Now, move that to <code>base/deployment.yaml</code> and also c...
Jonas
<p>I have many services. In a day, a few services are busy for about ten hours, while most other services are idle or use a small amount of cpu.</p> <p>In the past, I put all services in a virtual machine with two cpus, and scale by cpu usage, there are two virtual machine at the busiest time, but most of the time ther...
Fulo Lin
<blockquote> <p>I put all services in a virtual machine with two cpus, and scale by cpu usage, there are two virtual machine at the busiest time, but most of the time there is only one.</p> </blockquote> <p>First, if you have any availability requirements, I would recommend to always have at least <strong>two</strong> ...
Jonas
<p>When a Kubernetes Spring-Boot app is launched with 8 instances, the app running in each node needs to fetch sequence number of the pod/container. There should be no repeating numbers for the pods/containers running the same app. Assume that a pod runs a single container, and a container runs only one instance of the...
Ashok Goli
<blockquote> <p>app is launched with 8 instances, the app running in each node needs to fetch sequence number of the pod</p> </blockquote> <p>It sounds like you are requesting a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-identity" rel="noreferrer">stable Pod identity</a>. If you...
Jonas
<p>What exactly are the practical consequences of missing consensus on a Kubernetes cluster? Or in other words: which functions on a Kubernetes cluster require consensus? What will work, what won't work? </p> <p>For example (and really only for example):</p> <ul> <li>will existing pods keep running?</li> <li>can pods...
stefan.at.kotlin
<p>Consensus is fundamental to etcd - the distributed database that Kubernetes is built upon. Without consensus you can <em>read</em> but not <em>write</em> from the database. E.g. if only 1 of 3 nodes is available.</p> <blockquote> <p>When you lose quorum etcd goes into a <strong>read only</strong> state where it c...
Jonas
<p>I am running an Argo workflow and getting the following error in the pod's log:</p> <pre><code>error: a container name must be specified for pod &lt;name&gt;, choose one of: [wait main] </code></pre> <p>This error only happens some of the time and only with some of my templates, but when it does, it is a template th...
user3877654
<p>This happens when you try to see logs for a pod with multiple containers and not specify for what container you want to see the log. Typical command to see logs:</p> <pre><code>kubectl logs &lt;podname&gt; </code></pre> <p>But your Pod has two container, one named &quot;wait&quot; and one named &quot;main&quot;. You...
Jonas
<p>I'm writing a Kubernetes Operator in Go and I would like to generate events in the same way Pods do, i.e. at each point of the reconciliation I want to write an event which can be examined using <code>kubectl describe myresource</code>.</p> <p>I found the package that would allow me to do that, but I don't understan...
Cris
<p>The Kubebuilder v1 book has a good example on how to <em>create</em> and <em>write</em> <code>Events</code> using an <a href="https://github.com/kubernetes/client-go/blob/master/tools/record/event.go#L88" rel="nofollow noreferrer">EventRecorder</a> from <code>client-go</code>.</p> <p>See <a href="https://book-v1.boo...
Jonas
<p>I'm trying to set a grace shutdown period for my pods. I found out you can add a field called <code>terminationGracePeriodSeconds</code> to the helm charts to set the period. I then looked for example and crossed upon these:</p> <p><a href="https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best...
CodeMonkey
<blockquote> <p>Is there a difference between the 2 kinds in regard to where I define this value?</p> </blockquote> <p>A <code>Deployment</code> has a field <code>template:</code> and that is actually a <code>PodTemplate</code> (most structure of a <code>Pod</code>) that includes the <code>terminationGracePeriodSeconds...
Jonas
<p>I am trying to determine a reliable setup to use with K8S to scale one of my deployments using an HPA and an autoscaler. I want to minimize the amount of resources overcommitted but allow it to scale up as needed.</p> <p>I have a deployment that is managing a REST API service. Most of the time the service will hav...
Allen
<p>Sounds like you need a Scheduler that take actual CPU utilization into account. This is not supported yet.</p> <p>There seem to be work on a this feature: <strong><a href="https://github.com/kubernetes-sigs/scheduler-plugins/tree/6b7e77af527d8db82afb5060e5474ed524bdc0d6/kep/61-Trimaran-real-load-aware-scheduling" re...
Jonas
<p>I have a PVC mounted on a pod. someone from my team has deleted files from it. Is there a way to recover those files? Also, can we find who deleted the files?</p>
Tad
<blockquote> <p>Is there a way to recover those files?</p> </blockquote> <p>Persistent Volumes and Persistent Volume Claims are only APIs provided by Kubernetes. Below these APIs, there is a storage system that <strong>may</strong> or <strong>may not</strong> implement backup features or mirroring. Check the documentat...
Jonas
<p>I noticed that we can create node by <a href="https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/node-v1/" rel="nofollow noreferrer">Kubernetes API</a></p> <ol> <li>What is the difference between <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/" rel="nofollow norefer...
Justin
<h2>Node object in Kubernetes API</h2> <p>You <em>can</em> create <em>Node objects</em> via Kubernetes API - these Node objects are just <em>representations</em> for nodes in the cluster, they must also exists e.g. a machine with a <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel...
Jonas
<p><code>kubectl apply &lt;file.yaml&gt; --save-config</code> creates or updates a deployment and saves the deployment as metadata.</p> <p>In the documentation it says</p> <blockquote> <p>--save-config[=false]: If true, the configuration of current object will be saved in its annotation. This is useful when you want to...
User12547645
<h2>kubectl apply</h2> <p><code>kubectl apply</code> use the data in an annotation <code>kubectl.kubernetes.io/last-applied-configuration</code> to see e.g. if any fields has been removed since the last apply. This is needed because some fields or annotations may have been added live in the cluster by e.g. a controller...
Jonas
<p>I am creating kubernetes secrets using the below command</p> <pre class="lang-sh prettyprint-override"><code>kubectl create secret generic test-secret --save-config --dry-run=client --from-literal=a=data1 --from-literal=a=data2 -o yaml | kubectl apply -f - </code></pre> <p>Now, I need to add new literals using kubec...
magic
<blockquote> <p>add new literals using kubectl imperative command</p> </blockquote> <p>When working with <em>imperative commands</em> it typically means that you don't save the change in a place outside the cluster. You can <strong>edit</strong> a Secret in the cluster directly:</p> <pre><code>kubectl edit secret test-...
Jonas
<ul> <li><p>This is more of a conceptual question and I could not find any information on the web or the documentation. I am trying to learn about the networking of kubernetes, so my question is more focuses on the conceptual part and not on the convention of deploying applications. From what I learnt so far, I can use...
Mark R. Chandar
<blockquote> <p>Is there a possible way to make these pods communicate with each other?</p> </blockquote> <p>They are indeed on different clusters, but networking and nodes are managed outside of Kubernetes. Depending on how you configure your networking (e.g. routing and subnets) this is possible. You can e.g. install...
Jonas
<p>I've multiple secrets created from different files. I'd like to store all of them in common directory <code>/var/secrets/</code>. Unfortunately, I'm unable to do that because kubernetes throws <strong>'Invalid value: "/var/secret": must be unique</strong> error during pod validation step. Below is an example of my p...
Lukasz Dynowski
<h2>Projected Volume</h2> <p>You can use a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/" rel="noreferrer">projected volume</a> to have two secrets in the same directory</p> <p><strong>Example</strong></p> <pre><code>apiVersion: v1 kind: Pod metadata: labels:...
Jonas
<p>I have two apps - one is a java based REST application (“A”) and the other one is a go lang based rego policy framework (“B”).</p> <p>I have run these two apps as containers in a single pod in K8s. However, I am not sure how can I get the incoming HTTP requests to first hit the “B” rego policy framework and based on...
N Deepak Prasath
<blockquote> <p>I am not sure how can I get the incoming HTTP requests to first hit the “B” rego policy framework</p> </blockquote> <p>A &quot;rego policy framework&quot;, e.g. OpenPolicyAgent are typically used as an assisting container.</p> <p>In this setup, your application receives the request, then <strong>ask</st...
Jonas
<p>We have a kops based k8s cluster running on AWS with deployments using EFS as Persistent Volume; Now we would to migrate to EKS with PVC Deployments</p> <p>could some one help me in migrating deployments using Persistent Volume claims to EKS cluster in AWS.</p>
Balu Virigineni
<p>You can not <em>move</em> <code>PersistentVolumeClaims</code> to another cluster, you need to re-create them in the new cluster. You need to backup the data and restore from backup in the new cluster.</p>
Jonas
<p>My requirement is to start a pod when a particular batch job is completed. </p> <p>Batch job yaml file </p> <pre><code>apiVersion: batch/v1 kind: Job metadata: name: topics spec: ttlSecondsAfterFinished: 100 template: metadata: labels: app: topics spec: containers: - env: ...
pythonhmmm
<blockquote> <p>start a pod</p> </blockquote> <p>What you have described with a <code>Deployment</code> is a <strong>deployment of a service</strong>, not only <em>starting</em> a pod.</p> <h2>Watch status of Kubernetes objects</h2> <blockquote> <p>when a particular batch job is completed.</p> </blockquote> <p>...
Jonas
<p>looking to understand the order in which kubenetes examine the pods using the 3 type of probes- startup, readiness and live.</p> <p>How to understand or design these 3 probes correctly for normal applications? What is the chance of getting conflict or breaking the application if the startup probe has wrong entries</...
Vowneee
<h2>Startup probe</h2> <p><strong>This runs first.</strong> When it succeeds, the Readiness Probe and Liveness Probe are run continuously. If this fails, the container is killed.</p> <p>Use this for &quot;slow staring apps&quot;, you can use the same command as Liveness if you want.</p> <blockquote> <p>The kubelet uses...
Jonas
<p>I have been shifting a project from kube to openshift. In minikube the project was working fine, but in minishift it gives the error</p> <pre><code> — Crash loop back off </code></pre> <p>This is from the minishift logs</p> <pre><code>[WARN] $TIMEZONE not set. [INFO] Docker date set to: Tue Apr 20 17:39:02 UTC 2021...
Brandon Kauffman
<p>OpenShift ignores the <code>USER</code>-directive from Dockerfiles and instead generates a random UID for the user in the container. There are some idea about security behind this.</p> <p>From OpenShift <a href="https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html" rel="nofollow norefer...
Jonas
<p>I restarted a pod in my kubernetes cluster but I feel like that someone rollbacked it because when I check, I see the last restarting date does not match with the date I restarted it.</p> <p>What I want is to have all restart date history. Assume I restarted my pod yesterday and today, I want to have yesterday date ...
kasko
<p>There is no easy built-in way to get the info that you want.</p> <p>The best would probably built a specific service to provide this info if it is important for you. You could listen for Pod-changes and Events in a such service to collect the data that you need.</p>
Jonas
<p>I am <a href="https://piotrminkowski.com/2021/02/18/blue-green-deployment-with-a-database-on-kubernetes/" rel="nofollow noreferrer">reading about blue green deployment with database changes on Kubernetes.</a> It explains very clearly and in detail how the process works:</p> <ol> <li>deploy new containers with the n...
Babyburger
<blockquote> <p>I am reading about blue green deployment with database changes on Kubernetes. It explains very clearly and in detail how the process works</p> </blockquote> <p>It's an interesting article. But I would not do database migration as described there. And Blue-Green deployment does not make this much easier,...
Jonas
<p>In my openshift cluster, I noticed that all my pods have a port that's open without me specifying it. Its the pott 443 which is apperantly used for the k8s api as mentiond in <a href="https://stackoverflow.com/questions/47523136/whats-the-purpose-of-the-default-kubernetes-service#:%7E:text=AFAIK%20the%20kubernetes%2...
Daniel Karapishchenko
<blockquote> <p>I noticed that all my pods have a port that's open without me specifying it.</p> </blockquote> <p>Yes, the <code>contanerPort:</code> is just metadata, the container might listen to other ports as well.</p> <blockquote> <p>Is this safe?, What opens the container port without me specifying it? Is there a...
Jonas
<p>I am using the below yaml file in which I am running 3container inside a pod using a tomcat image, I have given the service type as loadbalancer, but I am not able to access the tomcat in the external browser.</p> <pre><code>apiVersion: v1 kind: Namespace metadata: name: tomcat labels: name: tomcat --- apiV...
AnandArc
<blockquote> <p>I want a simple configuration where I am creating multiple instances of Tomcat and load balancing to them. Say 3 instances to start with and then can go up to 5.</p> </blockquote> <p>You achieve this by using a single <code>Deployment</code> manifest, with <strong>one</strong> instance of your container...
Jonas
<p>I want to architect a message application using Websockets running on Kubernetes and want to know how to solve some problems...</p> <p><strong>Context</strong></p> <p>So, say you are building a chat application... Your chat application needs to frequently communicate with the back-end to work (e.g. receive sent me...
VimHax
<h2>Websockets: One request - long running connection</h2> <p>Your problem about <strong>Load balancing</strong> will be handled. Clients will be load balanced to different instances. When using Websockets, clients do <strong>one request</strong> to connect, they then keep that TCP connection to the backend and send m...
Jonas
<p>I have a Kubernetes project managed by Kustomized (Kubernetes). This project deploys two deployments in the same namespace.</p> <p>Basically, I have the following directory structure:</p> <pre><code>kustomize -&gt; app1 -&gt; kustomization.yaml kustomize -&gt; app1 -&gt; namespace.yaml kustomize -&gt; app1 -&gt; app...
Salvatore D'angelo
<p>You can have this directory structure:</p> <pre><code>kustomize -&gt; ns -&gt; namespace.yaml kustomize -&gt; app1 -&gt; kustomization.yaml kustomize -&gt; app1 -&gt; app1.yaml kustomize -&gt; app2 -&gt; kustomization.yaml kustomize -&gt; app2 -&gt; app2.yaml </code></pre> <p>Also you can add a <code>kustomization...
Jonas
<p>We have a docker container which is a CLI application, it runs, does it s things and exits.</p> <p>I got the assignment to put this into kubernetes but that containers can not be deployed as it exits and then is considered a crashloop.</p> <p>So the next question is if it can be put in a job. The job runs and gets r...
Serve Laurijssen
<blockquote> <p>So the next question is if it can be put in a job.</p> </blockquote> <p>If it is supposed to just run once, a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer">Kubernetes Job</a> is a good fit.</p> <blockquote> <p>The job runs and gets restarted every tim...
Jonas
<p>I am surprised that nobody has yet asked this, but what exactly is <code>deployment.apps</code>?</p> <p>I see it often in commands e.g</p> <pre><code>kubectl rollout pause deployment.apps/nginx-deployment </code></pre> <p>or even used interchangably for the <code>deployments</code> keyword: <code>kubectl get deploym...
Dimi
<p>Kubernetes API has its different resources (e.g. Pods, Deployments, Ingress) grouped in what they call &quot;<a href="https://kubernetes.io/docs/reference/using-api/#api-groups" rel="nofollow noreferrer">api groups</a>&quot; and in the notation <code>deployment.apps</code> - &quot;<a href="https://kubernetes.io/docs...
Jonas
<p>We currently have VM environment setup with an internal network and a DMZ network. Historically we had no open ports between these environments, but needs arose for communication between the internet and services/APIs running on our internal servers.</p> <p>We decided to use our DMZ network as a proxy/gateway, where...
Dynde
<blockquote> <p>if there'd be any &quot;real&quot; difference to security, if we were to forego the DMZ proxy, and exposing ports 80/443 directly from the internet to our internal k8s cluster, and handle all the security/authentication/authorization through the ingress controller on our cluster.</p> </blockquote> <bloc...
Jonas
<p>We have a Kubernetes cluster that has several deployments, each of which can have multiple pods running at a time (so far so standard). We need to do some database migrations (not hosted on the cluster), and can't have any of our code potentially altering values while that is happening - as such we need to take offl...
Jake Conkerton-Darby
<blockquote> <p>How can I take all pods of a Kubernetes deployment offline?</p> </blockquote> <p>I would recommend to scale the Deployment to <strong>0 replicas</strong> in this case.</p> <p>Use e.g.</p> <pre><code>kubectl scale deployment &lt;my-app&gt; --replicas=0 </code></pre> <p>You can easyli restore this by scal...
Jonas
<p>I made a demo with kubernetes/go-client where i tried to list pods from my cluster.</p> <pre><code> config, err := rest.InClusterConfig() if err != nil { panic(err.Error()) } clientset, err := kubernetes.NewForConfig(config) if err != nil { panic(err.Error()) } pods, err...
Jaime Yera
<p>You need to check if the <code>err</code> on the last line is non-nil.</p> <pre><code>pods, err := clientset.CoreV1().Pods(&quot;&quot;).List(context.TODO(), metav1.ListOptions{}) </code></pre> <blockquote> <p>OK, there is the problem. pods is forbidden: User &quot;system:serviceaccount:mis-pruebas:sa-prueba-go&quot...
Jonas
<p><strong>Context:</strong> I am using Linux and Windows nodes in a Kubernetes cluster. Depending on the OS where a pod is deployed, I need to use a specific image.</p> <p><strong>Question:</strong> Is there a way to express this in a Kubernetes yaml files: &quot;if this label exist on the pod you are deploying, then ...
Absolom
<p>The proper way to do this is to build &quot;multi-arch&quot; images, e.g. so that your container image contains binaries for multiple architectures. See e.g. <a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/building-windows-multi-arch-images" rel="nofollow noreferrer">Building Windows Server multi-...
Jonas
<p>I have just created a GKE cluster on Google Cloud platform. I have installed in the cloud console <code>helm</code> :</p> <pre><code>$ helm version version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"} </code></pre> <p>I have also cre...
pkaramol
<blockquote> <p>However trying to initialise tiller gives me the following error:</p> <p>Error: unknown flag: --service-account</p> <p>Why is that?</p> </blockquote> <p><a href="https://helm.sh/blog/helm-3-released/" rel="noreferrer">Helm <strong>3</strong> is a major upgrade</a>. The <strong>Tiller</strong> component ...
Jonas
<pre><code>initContainers: - name: git-clone-openg2p image: bitnami/odoo command: [&quot;/bin/sh&quot;,&quot;-c&quot;] args: ['apt-get git &amp;&amp; git clone https://github.com/repo.git &amp;&amp; git clone https://github.com/repo.git /bitnami/odoo'] volumeMounts: - name: odoo-data mou...
Ricardo1998
<p>As far as I know, there is no command <code>apt-get get</code>, you probably want:</p> <pre><code>apt-get install -y git </code></pre>
Jonas
<p>How do I ping my api which is running in kubernetes environment in other namespace rather than default. Lets say I have pods running in 3 namespaces - default, dev, prod. I have ingress load balancer installed and configured the routing. I have no problem in accessing default namespace - <a href="https://localhost/m...
Vinod T Kumar
<h2>Route traffic with Ingress to Service</h2> <p>When you want to route request from external clients, via <code>Ingress</code> to a <code>Service</code>, you should put the <code>Ingress</code> and <code>Service</code> object in the <em>same namespace</em>. I recommend to use different <em>domains</em> in your <cod...
Jonas
<p>I tried to use K8s to setup spark cluster (I use standalone deployment mode, and I cannot use k8s deployment mode for some reason)</p> <p>I didn't set any cpu related arguments.</p> <p>for spark, that means:</p> <blockquote> <p>Total CPU cores to allow Spark applications to use on the machine (default: all avai...
Green
<h2>Kubernetes - No upper bound</h2> <blockquote> <p>The Container has no upper bound on the CPU resources it can use. The Container could use all of the CPU resources available on the Node where it is running</p> </blockquote> <p>Unless you confgure a <code>limit</code> on CPU for your pod, it <em>can</em> use all...
Jonas
<p>I have a GKE cluster running on Google Cloud. I created a persistence volume and mounted my deployments, So the connectivity between my application and persistence are bounded successfully.</p> <p>I also have filebeat running on the same cluster using the below link <a href="https://github.com/elastic/beats/blob/mas...
klee
<p>FileBeat should use volumes a bit different than volumes. Typically applications logs to <em>stdout</em> and then the <em>container runtime</em> (e.g. Docker daemon or containerd) persist the logs on the local node.</p> <p>FileBeat need to run on every node, so it should be deployed using <code>DaemonSet</code> as y...
Jonas
<p>I have 2 pods, one that is writing files to a persistent volume and the other one supposedly reads those files to make some calculations.</p> <p>The first pod writes the files successfully and when I display the content of the persistent volume using <code>print(os.listdir(persistent_volume_path))</code> I get all t...
camelia
<p>When two pods should access a shared Persistent Volume with <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">access mode</a> <code>ReadWriteOnce</code>, concurrently - then the two pods must be running on the <strong>same node</strong> since the volume ...
Jonas
<p>I'm kinda new to Kubernetes and I would like to know which kind of configuration/state/metadata files etcd cluster holds? didn't find any examples on that. just general explanation.</p> <p>Thanks :)</p>
monsal
<blockquote> <p>which kind of configuration/state/metadata files etcd cluster holds?</p> </blockquote> <p>Etcd is the database for Kubernetes, so it essentially store all configuration/state/metadata that you have in your cluster.</p> <h3>How Kubernetes works</h3> <p>Kubernetes is an eventual consistency system.</p> <o...
Jonas
<p>I've been looking for documentation for a long time and still couldn't find any clear connection procedure. I came up with this code sample :</p> <pre><code>package aws import ( &quot;fmt&quot; &quot;net/http&quot; &quot;github.com/aws/aws-sdk-go/aws/session&quot; &quot;github.com/aws/aws-sdk-go/se...
raphael.oester
<p>Have you had a look at the <a href="https://github.com/kubernetes/client-go/blob/master/examples/in-cluster-client-configuration/main.go" rel="nofollow noreferrer">client-go example</a> on how to authenticate in-cluster?</p> <p>Code that authenticate to the Kubernetes API typically start like this:</p> <pre><code> ...
Jonas
<p>What type of edits will change a ReplicaSet and StatefulSet AGE(CreationTimeStamp)?</p> <p>I'm asking this because I noticed that</p> <ol> <li>If I change a Deployment image, a new ReplicaSet will be created.</li> <li>The old ReplicaSet continues to exist with DESIRED set to 0.</li> <li>If I change back to the previ...
Kaio H. Cunha
<blockquote> <p>AGE(CreationTimeStamp)</p> </blockquote> <p>A resource's <code>CreationTimeStamp</code> (and thereby its age) is set when a resource is <strong>created</strong>. E.g. to change it, you must <em>delete</em> the resource and create it again.</p>
Jonas
<p>When deciding on update strategy for a kubernetes application, there is an option to use <code>Recreate</code> strategy.</p> <p>How would this be different from just uninstalling and installing the app?</p>
as.tek
<p><code>Recreate</code> strategy will delete your Pods and then add new Pods - you will get short downtime, but on the other side you will not use much extra resources during upgrade.</p> <p>You typically want <code>RollingUpgrade</code> since that takes a few Pods at a time and you can deploy stateless applications w...
Jonas
<p>I mean is there a one to one or many to one relationship between pod and PVC? Can I connect two or more pods to the same PVC(persistent volume claims) without deleting or disconnecting the earlier created pods?</p>
Aniket
<blockquote> <p>Can I connect two or more pods to the same PVC(persistent volume claims) without deleting or disconnecting the earlier created pods?</p> </blockquote> <p>Yes, this works. But in practice this is a bit more complicated.</p> <p>Persistent Volumes can be created with different <a href="https://kubernetes.i...
Jonas
<p>For <code>kubectl describe</code> I can abbreviate a few classes of resources, for example:</p> <pre><code>po/xxx -&gt; pods/xxx rs/xxx -&gt; replicasets/xxx </code></pre> <p>Where can I find the full list?</p> <p>I'm trying to find the abbreviation for deployments.</p>
gabriel
<p>To get a full list of your resources, including their <em>shortname</em>, use:</p> <pre><code>kubectl api-resources </code></pre> <p>e.g. Deployment has the shorthname <code>deploy</code>.</p> <hr /> <p>Example output from <code>kubectl api-resources</code>:</p> <pre><code>NAME SHORTNAMES APIVERSION NAMESP...
Jonas
<p>If I have two services ServiceA and ServiceB. Both are of ServiceType ClusterIP, so if I understand correctly both services are not accessible from outside of the cluster.</p> <p>Do I then need to setup encryption for these services or is in-cluster-communication considered as secure?</p>
Matthias Gilch
<blockquote> <p>Do I then need to setup encryption for these services or is in-cluster-communication considered as secure?</p> </blockquote> <p>The level of security you want to use is up to you. In regulated industries, e.g. in banks, it is popular to apply a <a href="https://rads.stackoverflow.com/amzn/click/com/1491...
Jonas
<p>In kubernetes POD I have an option to mount a secret or a configmap as a volume mounted to the POD. It would be difficult to access these files as environment variables. So why should I be doing it instead of using them as environment variables?</p>
Aditya Bhuyan
<p>This depends on how the application expect to load the secret.</p> <p>E.g. if the application expect to load an <a href="https://www.tutorialsteacher.com/https/ssl-certificate-format" rel="nofollow noreferrer">SSL certificate file</a>, it is possible to have the certificated as a file in a Secret and mount the Secre...
Jonas
<p>Below is kubernetes POD definition</p> <pre><code>apiVersion: v1 kind: Pod metadata: name: static-web labels: role: myrole spec: containers: - name: web image: nginx ports: - name: web containerPort: 80 protocol: TCP </code></pre> <p>as I have not specified the r...
One Developer
<p>If resources are not specified for the Pod, the Pod will be scheduled to any node and resources are not considered when choosing a node.</p> <p>The Pod might be &quot;terminated&quot; if it uses more memory than available or get little CPU time as Pods with specified resources will be prioritized. It is a good pract...
Jonas
<p>I have a Cassandra statefulSet in my Kubernetes cluster with a high terminationGracePeriod to handle data handover currently.</p> <p>the problem is when a host machine goes down, K8s waits whole terminationGracePeriod in termination phase before rescheduling my pod on another node.</p> <p>how can i make K8s to ignor...
Aref Riant
<blockquote> <p>the problem is when a host machine goes down, K8s waits whole terminationGracePeriod in termination phase before rescheduling my pod on another node.</p> </blockquote> <p>I think this is wrong assumption. When a host machine goes down, the node health check is used to detect this. Typically this is e.g....
Jonas
<p>I have a deployment.yaml which has a readiness probe on the container. (The readiness probe is intended to fail here)</p> <pre><code>apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: nginx name: my-nginx-deployment spec: replicas: 2 selector: matchLabels: app...
saurabh_garg
<p>The <code>port-forward</code> <a href="https://v1-17.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#create-connect-portforward-pod-v1-core" rel="nofollow noreferrer">api</a> is for a Pod. The <code>kubectl port-forward</code> command just use <em>service</em> to make it easy to use, but your port ...
Jonas
<p>I have created a simple flask api with swagger integration using flask_restplus library. It is working fine in localhost. But when I use it in gcp kubernetes ingress, it is giving results for endpoints but not able to show the documentation or swagger ui. Here are the browser console errors <a href="https://i.stack....
HarshR
<p>Your endpoint return a script that references other scripts located on <code>/swaggerui/*</code> but that path is not defined in your Ingress.</p> <p>It may be solved if you add that path to your service as well</p> <pre><code> - path: /swaggerui/* backend: serviceName: restplustest servicePort: 5...
Jonas
<p>Github repo: <a href="https://github.com/oussamabouchikhi/udagram-microservices" rel="nofollow noreferrer">https://github.com/oussamabouchikhi/udagram-microservices</a></p> <p>After I configured the kubectl with the AWS EKS cluster, I deployed the services using these commands</p> <pre><code>kubectl apply -f env-con...
Oussama Bouchikhi
<p>From your <code>kubectl describe pod &lt;podname&gt;</code></p> <blockquote> <p>Warning FailedScheduling 2m19s (x136 over 158m) default-scheduler 0/2 nodes are available: 2 Too many pods.</p> </blockquote> <p>When you see this, it means that your nodes in AWS EKS is full.</p> <p><strong>To solve this, you need t...
Jonas
<p>I've worked through <a href="https://kubernetes.io/docs/tutorials/hello-minikube/" rel="nofollow noreferrer">my first Kubernetes tutorial</a>.</p> <p>Near the end, this tutorial introduced the concept of &quot;add-ons&quot; -- for example, you can install the <code>metrics-server</code> add-on by running</p> <pre><c...
Alana Storm
<blockquote> <p>What are these add-ons? Are they a feature that's specifically related to minikube</p> </blockquote> <p>Yes, this is specific to Minikube.</p> <p>Kubernetes is manly a container orchestrator. It is typically installed in an environment with lots of servers, e.g. a Cloud Provider like AWS or GCP. Kuberne...
Jonas
<p>I have a kubernetes HPA set up in my cluster, and it works as expected scaling up and down instances of pods as the cpu/memory increases and decreases.</p> <p>The only thing is that my pods handle web requests, so it occasionally scales down a pod that's in the process of handling a web request. The web server neve...
harbinja
<h1>Graceful shutdown of pods</h1> <p>You must design your apps to support <em>graceful shutdown</em>. First your pod will receive a <code>SIGTERM</code> signal and after 30 seconds (can be configured) your pod will receive a <code>SIGKILL</code> signal and be removed. See <a href="https://kubernetes.io/docs/concepts/w...
Jonas
<p>I have an OpenShift/Tekton pipeline which in <code>Task A</code> deploys an application to a test environment. In <code>Task B</code>, the application's test suite is run. If all tests pass, then the application is deployed to another environment in <code>Task C</code>.</p> <p>The problem is that <code>Task A</code>...
Andreas Bradahl
<p>After your <em>step</em> that do <code>oc apply</code>, you can add a step to wait for the deployment to become &quot;available&quot;. This is for <code>kubectl</code> but should work the same way with <code>oc</code>:</p> <pre><code>kubectl wait --for=condition=available --timeout=60s deployment/myapp </code></pre>...
Jonas
<p>I have built a self-service platform based on Kubernetes, where we create namespaces for each team and allow them to 'do whatever they want within the namespace' (we set resource limits so no one can kill the whole cluster).</p> <p>However, now I want to implement some kind of standard across the organization. For ...
dayuloli
<blockquote> <p>Is there a mechanism that will allow the API server to check the manifests being applied against a set of rules, and if it fails the check the manifest is rejected.</p> </blockquote> <p>In general, this may be solved by an <a href="https://kubernetes.io/docs/reference/access-authn-authz/extensible-admis...
Jonas
<p>I have a pod in kubernetes with the request CPU 100m and Limit cpu with 4000m.</p> <p>The application spins up 500+ threads and it works fine. The application becomes unresponsive during heavy load and could be because of the thread limit issue.</p> <p><strong>Question:-</strong></p> <p>The number of threads are rel...
user1578872
<blockquote> <p>Since, the request CPU is 100m, Will there be any problem in the thread limitation, or, pod can still spin up more threads as the Limit is 4000m.</p> </blockquote> <p>The CPU limitation is 4000m (4 cores), so it can use as many threads as it wants and use CPU utilization up to 4 cores.</p> <p>The CPU re...
Jonas
<p>Does Kubernetes have a way of reusing manifests without copying and paste them? Something akin to Terraform templates.</p> <p>Is there a way of passing values between manifests?</p> <p>I am looking to deploy the same service to multiple environments and wanted a way to call the necessary manifest and pass in the e...
Confounder
<p><a href="https://kustomize.io/" rel="nofollow noreferrer">Kustomize</a>, now part of <code>kubectl apply -k</code> is a way to <em>parameterize</em> your Kubernetes manifests files.</p> <p>With Kustomize, you have a <em>base manifest</em> file (e.g. of <code>Deployment</code>) and then multiple <em>overlay</em> dir...
Jonas
<p>I'm new to Kubernetes (K8s). It's my understanding that in order to &quot;do things&quot; in a kubernetes cluster, we interact with a kuberentes REST API endpoint and create/update/delete objects. When these objects are created/updated/deleted K8s will see those changes and take steps to bring the system in-line w...
Alana Storm
<blockquote> <p>Is there a canonical description of all the possible configuration fields for these objects?</p> </blockquote> <p>Yes, there is the <a href="https://kubernetes.io/docs/reference/kubernetes-api/" rel="noreferrer">Kubernetes API reference</a> e.g. for <a href="https://kubernetes.io/docs/reference/kubernet...
Jonas
<p>I have a main pod that accesses and makes Kubernetes API calls to deploy other pods (the code similar below). It works fine. Now, I don't want to use the config file. I know it's possible with a service account. <a href="https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/" rel="nofollow noref...
Kevin N
<p>The official Java client has example for <a href="https://github.com/kubernetes-client/java/blob/master/examples/examples-release-13/src/main/java/io/kubernetes/client/examples/InClusterClientExample.java" rel="nofollow noreferrer">in-cluster client example</a>.</p> <p>It is quite similar to your code, you need to u...
Jonas
<p>I am currently switching from Service Fabric to Kubernetes and was wondering how to do custom and more complex load balancing.</p> <p>So far I already read about Kubernetes offering "Services" which do load balancing for pods hidden behind them, but this is only available in more plain ways.</p> <p>What I want to ...
Sossenbinder
<h1>StatefulSet</h1> <p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="noreferrer">StatefulSet</a> is a <em>building block</em> for stateful workload on Kubernetes with certain guarantees.</p> <h2>Stable and unique network identity</h2> <blockquote> <p>StatefulSet Pods have a...
Jonas
<p>I am using the ECK <a href="https://github.com/elastic/cloud-on-k8s" rel="nofollow noreferrer">operator</a>, to create an <code>Elasticsearch</code> instance.</p> <p>The instance uses a <code>StorageClass</code> that has <code>Retain</code> (instead of <code>Delete</code>) as its reclaim policy.</p> <p>Here are my <...
pkaramol
<blockquote> <p>with the hope that due to the Retain policy, the new pods (i.e. their PVCs would bind to the existing PVs (and data wouldn't get lost)</p> </blockquote> <p>It is explicitly written in the <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#retain" rel="nofollow noreferrer">documenta...
Jonas
<p>In kubernetes we can set limits and requests for cpu. If the container exceeds the limit, from my understanding it will be throttled. However if the container exceeds the requested but is still under the limit what would happen?</p> <p>Would I see performance issues on my application?</p>
user2962698
<blockquote> <p>However if the container exceeds the requested but is still under the limit what would happen?</p> </blockquote> <p>Nothing happens. The resource request is used for scheduling your pod to a node with capacity.</p> <p>If the resources are scarce on your node, it may be evicted.</p>
Jonas
<p>According to <a href="https://kubernetes.io/docs/concepts/architecture/control-plane-node-communication/" rel="nofollow noreferrer">Control Plane-Node Communication</a>,</p> <p>the only way to communicate securely in an insecure network would be API-kubelet communication using parameter or SSH; and the other way men...
Sergio Barrientos
<p>As I read it, it is possible to use use the <code>--kubelet-certificate-authority</code> flag to provide a root certificate bundle.</p> <p>But this is a narrow use case, that you also could avoid in a production environment, perhaps?</p> <blockquote> <p>To verify this connection, use the --kubelet-certificate-author...
Jonas
<p>I'm completely new to Kubernetes, I'm a bit lost of were to search. I would like to have blue-green deployment between with a web application solution. I've been told that the blue pods are destroyed when there is no user session anymore associated to the blue pods. Is this right? In some web pages I'm reading that ...
Elena
<p><strong>Blue Green Deployment</strong></p> <p>Blue Green deployment is not a standard feature in Kubernetes. That means that there are many different 3rd party products for this, or patterns. And all products and pattern differ in <strong>how</strong> they do this.</p> <p><strong>Example:</strong> <a href="https:/...
Jonas
<p>I learnt that Kubernetes running via Minikube or kind (that's what I'm using) does not have a Load Balancer. That functionality comes from cloud providers. However, when I created a simple deployment with 3 replicas and a service:</p> <pre class="lang-sh prettyprint-override"><code>kubectl create deployment kiada --...
mnj
<p>A Kubernetes Service will load balance requests to any of the Pods matching the labels specified in the Service.</p> <p>Don't mix this with <code>type: LoadBalancer</code> which is a way to <strong>expose</strong> your Service using a <em>Cloud Load Balancer</em>, typically with an <em>external IP address</em>.</p>
Jonas
<p>I'm new to Kubernetes and wondering, if there's a <code>kubectl</code> command to figure out what namespace I'm currently working in?</p> <p>Running the <code>kubectl get ns</code> command prints out all the namespaces but doesn't show which one I'm in at present.</p>
Metro
<p>You want to inspect the local config for <code>kubectl</code> and see current context. This shows your current context with namespace.</p> <pre><code>kubectl config get-contexts </code></pre> <p>Example output - can also be multiple clusters, but only one &quot;current&quot;:</p> <pre><code>$kubectl config get-cont...
Jonas
<p>I tries running rabbitmq following the book Kubernetes for developers (page 180): <strong>rabbitmq.yml</strong></p> <pre><code>--- # EXPORT SERVICE INTERFACE kind: Service apiVersion: v1 metadata: name: message-queue labels: app: rabbitmq role: master tier: queue spec: ports: - port: 56...
Ciasto piekarz
<blockquote> <p>0/3 nodes are available: 3 pod has unbound immediate PersistentVolumeClaims.</p> </blockquote> <p>The pod cannot be scheduled because the PVC that it is using is not &quot;bound&quot;. You need to investigate why the PVC is not bound, something related to the storage system that you use.</p>
Jonas
<p>I'm currently writing the manifests for a few services in my home server that require persistent storage. I want to use PVs and PVCs. Do I create one single big PV and share that among all services? Or is it a 1:1 relation between PVCs and PVs?</p> <p>I'm not asking about the different between PVs and PVCs. This has...
trallnag
<p>It is a one-to-one relationship.</p> <p>You can have many PVs in your environment. A specific PVC is a <strong>claim</strong> for a specific instance that match your requested criterias, e.g. size and type. The volume will be claimed and hold your data as long as your PVC-resource exist in your cluster, but if you d...
Jonas