{"id":8564,"date":"2025-11-09T18:59:26","date_gmt":"2025-11-09T18:59:26","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=8564"},"modified":"2025-11-09T18:59:26","modified_gmt":"2025-11-09T18:59:26","slug":"all-about-kubernetes-v1-34","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=8564","title":{"rendered":"All About Kubernetes v1.34"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p dir=\"ltr\">Kubernetes has steadily advanced into an trade commonplace for container orchestration, powering platforms from small developer clusters to hyperscale AI and knowledge infrastructures. Each new launch introduces options that not solely make workloads simpler to handle but additionally enhance efficiency, price effectivity, and resilience.<\/p>\n<p dir=\"ltr\">With the v1.34 launch, one of many standout enhancements is the introduction of visitors distribution preferences for Kubernetes Companies. Particularly:<\/p>\n<ol>\n<li dir=\"ltr\"><strong>PreferSameNode<\/strong>: route visitors to the identical node because the consumer pod if doable.<\/li>\n<li dir=\"ltr\"><strong>PreferSameZone<\/strong>: routing visitors by giving choice to endpoints in the identical topology zone earlier than going for cross-zone.<\/li>\n<\/ol>\n<p dir=\"ltr\">These insurance policies add smarter, locality-aware routing to Service visitors distribution. As an alternative of treating all pods equally, Kubernetes can now choose pods which might be nearer to the consumer, whether or not on the identical node or in the identical availability zone (AZ).<\/p>\n<p dir=\"ltr\">This transformation is straightforward, but it surely has significant implications for performance-sensitive and cost-sensitive workloads, notably in giant multi-node and multi-zone clusters.<\/p>\n<h2 dir=\"ltr\">Site visitors Distribution Significance<\/h2>\n<p dir=\"ltr\">Historically, a <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/dzone.com\/articles\/kubernetes-services-explained-cluster-ip-nodeport\">Kubernetes Service<\/a> balances visitors evenly throughout all endpoints\/pods that match its selector. This even visitors distribution is straightforward, predictable, and works nicely for many use instances.<\/p>\n<p dir=\"ltr\">Nevertheless, it doesn&#8217;t think about topology, the bodily or logical placement of pods throughout nodes and zones.<\/p>\n<h3 dir=\"ltr\">Spherical-Robin Challenges<\/h3>\n<ul>\n<li><strong>Elevated latency<\/strong>: If a consumer pod on Node A routes to a Service endpoint on Node B (or worst case to a unique zone), the additional community hop provides milliseconds of delay.<\/li>\n<li><strong>Cross-zone prices<\/strong>: In cloud environments, cross-az visitors is usually billed by cloud suppliers; even a couple of mb&#8217;s of cross-zone visitors throughout 1000&#8217;s of pods can rack up important prices.<\/li>\n<li><strong>Cache inefficiency<\/strong>: Some ML inference companies cache fashions in reminiscence per pod. If requests bounce throughout pods randomly, cache hit charges enhance, hurting each efficiency and useful resource effectivity.<\/li>\n<\/ul>\n<h2>What\u2019s New in Kubernetes v1.34<\/h2>\n<p>The brand new trafficDistribution discipline, Kubernetes companies now help an non-compulsory discipline below spec:<\/p>\n<div class=\"codeMirror-wrapper newest\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"spec:&#10;  trafficDistribution: PreferSameNode | PreferSameZone\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">spec:\n\u00a0 trafficDistribution: PreferSameNode | PreferSameZone<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<ul>\n<li><strong>Default habits (if unset)<\/strong>: visitors remains to be distributed evenly throughout all endpoints.<\/li>\n<li><strong>PreferSameNode<\/strong>: The kube-proxy (or service proxy) will try to ship visitors to pods working on the identical node because the consumer pod. If no such endpoints can be found, it falls again to zone-level or cluster-wide balancing.<\/li>\n<li><strong>PreferSameZone<\/strong>: The proxy will prioritize endpoints throughout the identical topology zone because the consumer pod. If none can be found, it falls again to cluster-wide distribution.<\/li>\n<\/ul>\n<h2>Site visitors Distribution Excessive-Stage Diagram<\/h2>\n<p><img decoding=\"async\" style=\"width: 718px;\" class=\"fr-fic fr-dib lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"137.7 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759715510356\" data-creationdateformatted=\"10\/06\/2025 01:51 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18681301-1759715509535.png\" data-modificationdate=\"null\" data-size=\"137674\" data-name=\"1759715509535.png\" data-id=\"18681301\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18681301-1759715509535.png\" alt=\"Traffic distribution high-level diagram\"\/><\/p>\n<p dir=\"ltr\">These preferences are non-compulsory, and if no choice is specified, then by default, the visitors might be evenly distributed throughout all endpoints within the cluster.<\/p>\n<h3 dir=\"ltr\">Advantages<\/h3>\n<ul>\n<li><strong>Decrease latency<\/strong>: Requests take fewer community hops when served regionally on the identical node or throughout the identical zone. That is particularly crucial for microservices with low SLA necessities or ML workloads the place inference instances are measured in milliseconds.<\/li>\n<li><strong>Decreased prices<\/strong>: Cloud suppliers usually cost for cross-zone visitors. Routing to native pods first avoids these expenses until essential.<\/li>\n<li><span style=\"margin: 0px; padding: 0px;\"><strong>Improved cache utilization<\/strong>: Workloads comparable to ML inference pods typically hold fashions, embeddings, or function shops heat in reminiscence, with the identical node routing, which will increase cache hit charges.<\/span><\/li>\n<li><strong>Constructed-in fault tolerance<\/strong>: Each insurance policies are preferences, not onerous necessities. If no native endpoints exist as a result of a node being drained or a zone outage, then Kubernetes seamlessly falls again to cluster-wide distribution.<\/li>\n<\/ul>\n<h3>Use Circumstances<\/h3>\n<ul>\n<li>ML inference companies cache heat fashions within the pod.<\/li>\n<li>Distributed programs the place knowledge nodes align with zones.<\/li>\n<li>Bigger orgs deploying throughout a number of AZs can obtain sensible failover as visitors stays native below regular circumstances, however failover seamlessly if the zone experiences an outage.<\/li>\n<\/ul>\n<h3>Demo Walkthrough<\/h3>\n<p dir=\"ltr\">We are going to attempt to cowl visitors distribution eventualities \u2014 default, PreferSameZone, PreferSameNode, and fallback \u2014 within the demo beneath.<\/p>\n<h4 dir=\"ltr\"><strong>Demo: Set Up Cluster, Deploy Pods, Companies, and Consumer<\/strong><\/h4>\n<p><strong>Step 1<\/strong>: Begin a multi-node cluster on minikube and label the nodes with zones:<\/p>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"minikube start -p mnode --nodes=3 --kubernetes-version=v1.34.0&#10;kubectl config use-context mnode&#10;&#10;kubectl label node mnode-m02 topology.kubernetes.io\/zone=zone-a --overwrite&#10;kubectl label node mnode-m03 topology.kubernetes.io\/zone=zone-b --overwrite\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">minikube begin -p mnode --nodes=3 --kubernetes-version=v1.34.0\nkubectl config use-context mnode\n\nkubectl label node mnode-m02 topology.kubernetes.io\/zone=zone-a --overwrite\nkubectl label node mnode-m03 topology.kubernetes.io\/zone=zone-b --overwrite<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<p><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"120.7 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759455515886\" data-creationdateformatted=\"10\/03\/2025 01:38 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675541-1759455515592.png\" data-modificationdate=\"null\" data-size=\"120680\" data-name=\"1759455515592.png\" data-id=\"18675541\" style=\"width: 753px; height: 437.863px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675541-1759455515592.png\" alt=\"Step 1\"\/><\/p>\n<p><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"19.7 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759455541563\" data-creationdateformatted=\"10\/03\/2025 01:39 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675543-1759455541320.png\" data-modificationdate=\"null\" data-size=\"19690\" data-name=\"1759455541320.png\" data-id=\"18675543\" style=\"width: 752px; height: 79.9468px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675543-1759455541320.png\" alt=\"Step 1\"\/><\/p>\n<p dir=\"ltr\"><strong>Step 2<\/strong>: Deploy the echo app with two replicas and the echo service.<\/p>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"# echo-pod.yaml&#10;apiVersion: apps\/v1&#10;kind: Deployment&#10;metadata:&#10;  name: echo&#10;spec:&#10;  replicas: 2&#10;  selector:&#10;    matchLabels:&#10;      app: echo&#10;  template:&#10;    metadata:&#10;      labels:&#10;        app: echo&#10;    spec:&#10;      containers:&#10;      - name: echo&#10;        image: hashicorp\/http-echo&#10;        args:&#10;          - &quot;-text=Hello from $(POD_NAME)&quot;&#10;        env:&#10;          - name: POD_NAME&#10;            valueFrom:&#10;              fieldRef:&#10;                fieldPath: metadata.name&#10;        ports:&#10;        - containerPort: 5678&#10;&#10;&#10;# echo-service.yaml&#10;apiVersion: v1&#10;kind: Service&#10;metadata:&#10;  name: echo-svc&#10;spec:&#10;  selector:&#10;    app: echo&#10;  ports:&#10;  - port: 80&#10;    targetPort: 5678&#10;\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\"># echo-pod.yaml\napiVersion: apps\/v1\nsort: Deployment\nmetadata:\n  title: echo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: echo\n  template:\n    metadata:\n      labels:\n        app: echo\n    spec:\n      containers:\n      - title: echo\n        picture: hashicorp\/http-echo\n        args:\n          - \"-text=Howdy from $(POD_NAME)\"\n        env:\n          - title: POD_NAME\n            valueFrom:\n              fieldRef:\n                fieldPath: metadata.title\n        ports:\n        - containerPort: 5678\n\n\n# echo-service.yaml\napiVersion: v1\nsort: Service\nmetadata:\n  title: echo-svc\nspec:\n  selector:\n    app: echo\n  ports:\n  - port: 80\n    targetPort: 5678\n<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"kubectl apply -f echo-pod.yaml&#10;kubectl apply -f echo-service.yaml&#10;# verify pods are running on separate nodes and zones&#10;kubectl get pods -l app=echo -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName --no-headers &#10;| while read pod node; do&#10;  zone=$(kubectl get node &quot;$node&quot; -o jsonpath=\" printf=\"\" done=\"\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">kubectl apply -f echo-pod.yaml\nkubectl apply -f echo-service.yaml\n# confirm pods are working on separate nodes and zones\nkubectl get pods -l app=echo -o=custom-columns=NAME:.metadata.title,NODE:.spec.nodeName --no-headers \n| whereas learn pod node; do\n  zone=$(kubectl get node \"$node\" -o jsonpath=\"{.metadata.labels.topology.kubernetes.io\/zone}\")\n  printf \"%-35s %-15s %sn\" \"$pod\" \"$node\" \"$zone\"\naccomplished\n<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<p dir=\"ltr\">As you possibly can see within the screenshot beneath, two echo pods spin up on separate nodes (mnode-m02, mnode-m03) and availability zones (zone-a, zone-b).<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"47.9 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759456969625\" data-creationdateformatted=\"10\/03\/2025 02:02 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675557-1759456969233.png\" data-modificationdate=\"null\" data-size=\"47948\" data-name=\"1759456969233.png\" data-id=\"18675557\" style=\"width: 773px; height: 159.223px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675557-1759456969233.png\" alt=\"Two echo pods spin up on separate nodes\"\/><\/p>\n<p>Step 3: Deploy a consumer pod in zone A.<\/p>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"# client.yaml&#10;apiVersion: v1&#10;kind: Pod&#10;metadata:&#10;  name: client&#10;spec:&#10;  nodeSelector:&#10;    topology.kubernetes.io\/zone: zone-a&#10;  restartPolicy: Never&#10;  containers:&#10;    - name: client&#10;      image: alpine:3.19&#10;      command: [&quot;sh&quot;, &quot;-c&quot;, &quot;sleep infinity&quot;]&#10;      stdin: true&#10;      tty: true&#10;\" data-lang=\"text\/x-yaml\">\n<pre><code lang=\"text\/x-yaml\"># consumer.yaml\napiVersion: v1\nsort: Pod\nmetadata:\n  title: consumer\nspec:\n  nodeSelector:\n    topology.kubernetes.io\/zone: zone-a\n  restartPolicy: By no means\n  containers:\n    - title: consumer\n      picture: alpine:3.19\n      command: [\"sh\", \"-c\", \"sleep infinity\"]\n      stdin: true\n      tty: true\n<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"kubectl apply -f client.yaml&#10;&#10;kubectl get pod client -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName --no-headers &#10;| while read pod node; do&#10;  zone=$(kubectl get node &quot;$node&quot; -o jsonpath=\" printf=\"\" done=\"\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">kubectl apply -f consumer.yaml\n\nkubectl get pod consumer -o=custom-columns=NAME:.metadata.title,NODE:.spec.nodeName --no-headers \n| whereas learn pod node; do\n  zone=$(kubectl get node \"$node\" -o jsonpath=\"{.metadata.labels.topology.kubernetes.io\/zone}\")\n  printf \"%-35s %-15s %sn\" \"$pod\" \"$node\" \"$zone\"\naccomplished\n<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<p><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"34.0 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457052690\" data-creationdateformatted=\"10\/03\/2025 02:04 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675560-1759457052427.png\" data-modificationdate=\"null\" data-size=\"34026\" data-name=\"1759457052427.png\" data-id=\"18675560\" style=\"width: 808px; height: 139.588px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675560-1759457052427.png\"\/><\/p>\n<p>Consumer pod is scheduled on node <em data-end=\"95\" data-start=\"84\">mnode-m02<\/em> in <em data-end=\"107\" data-start=\"99\">zone-a<\/em>.<\/p>\n<p dir=\"ltr\">Step 4: Arrange a helper script within the consumer pod.<\/p>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"kubectl exec -it client -- sh&#10;apk add --no-cache curl jq&#10;cat &gt; \/hit.sh &lt;&lt;'EOS'&#10;#!\/bin\/sh&#10;COUNT=&quot;${1:-20}&quot;&#10;SVC=&quot;${2:-echo}&quot;&#10;PORT=&quot;${3:-80}&quot;&#10;i=1&#10;while [ &quot;$i&quot; -le &quot;$COUNT&quot; ]; do&#10;  curl -s &quot;http:\/\/${SVC}:${PORT}\/&quot; &#10;   | jq -r '.env.POD_NAME + &quot;@&quot; + .env.NODE_NAME'&#10;  i=$((i+1))&#10;done | sort | uniq -c&#10;EOS&#10;&#10;chmod +x \/hit.sh&#10;&#10;exit&#10;\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">kubectl exec -it consumer -- sh\napk add --no-cache curl jq\ncat &gt; \/hit.sh &lt;&lt;'EOS'\n#!\/bin\/sh\nCOUNT=\"${1:-20}\"\nSVC=\"${2:-echo}\"\nPORT=\"${3:-80}\"\ni=1\nwhereas [ \"$i\" -le \"$COUNT\" ]; do\n  curl -s \"http:\/\/${SVC}:${PORT}\/\" \n   | jq -r '.env.POD_NAME + \"@\" + .env.NODE_NAME'\n  i=$((i+1))\naccomplished | kind | uniq -c\nEOS\n\nchmod +x \/hit.sh\n\nexit\n<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<p><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"56.3 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457105503\" data-creationdateformatted=\"10\/03\/2025 02:05 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675564-1759457105210.png\" data-modificationdate=\"null\" data-size=\"56322\" data-name=\"1759457105210.png\" data-id=\"18675564\" style=\"width: 793px; height: 296.387px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675564-1759457105210.png\"\/><\/p>\n<p><img decoding=\"async\" width=\"378\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"20.7 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457115310\" data-creationdateformatted=\"10\/03\/2025 02:05 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675565-1759457115064.png\" data-modificationdate=\"null\" data-size=\"20742\" data-name=\"1759457115064.png\" data-id=\"18675565\" style=\"width: 422px; height: 226.476px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675565-1759457115064.png\"\/><\/p>\n<h4 dir=\"ltr\"><strong>Demo: Default Habits<\/strong><\/h4>\n<p dir=\"ltr\">Type consumer shell run script: hit.sh to generate visitors from consumer pod to echo service.<\/p>\n<p><img decoding=\"async\" width=\"359\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"6.1 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457228449\" data-creationdateformatted=\"10\/03\/2025 02:07 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675567-1759457228216.png\" data-modificationdate=\"null\" data-size=\"6061\" data-name=\"1759457228216.png\" data-id=\"18675567\" style=\"width: 412px; height: 69.8989px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675567-1759457228216.png\"\/><\/p>\n<p dir=\"ltr\"><strong>Habits<\/strong>: Within the beneath screenshot, you possibly can see visitors routed to each pods (10 requests every) in round-robin type.<\/p>\n<h4 dir=\"ltr\"><strong>Demo: PreferSameNode<\/strong><\/h4>\n<p dir=\"ltr\">Patch echo service definition spec so as to add\/patch visitors distribution: PreferSameNode.<\/p>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"kubectl patch svc echo --type merge -p '{&quot;spec&quot;:{&quot;trafficDistribution&quot;:&quot;PreferSameNode&quot;}}'&#10;\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">kubectl patch svc echo --type merge -p '{\"spec\":{\"trafficDistribution\":\"PreferSameNode\"}}'\n<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<p dir=\"ltr\">Type consumer shell run script:hit.sh to generate visitors from consumer pod to echo service.<\/p>\n<p dir=\"ltr\"><strong>Habits<\/strong>: Site visitors ought to get routed to pod:echo-687cbdc966-mgwn5@mnode-m02 residing on the identical node:mnode-m02 as consumer pod.<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"21.9 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457434367\" data-creationdateformatted=\"10\/03\/2025 02:10 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675571-1759457434135.png\" data-modificationdate=\"null\" data-size=\"21903\" data-name=\"1759457434135.png\" data-id=\"18675571\" style=\"width: 796px; height: 75.3688px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675571-1759457434135.png\"\/><\/p>\n<p><img decoding=\"async\" width=\"423\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"3.4 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457465678\" data-creationdateformatted=\"10\/03\/2025 02:11 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675572-1759457465432.png\" data-modificationdate=\"null\" data-size=\"3375\" data-name=\"1759457465432.png\" data-id=\"18675572\" style=\"width: 606px; height: 20.0567px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675572-1759457465432.png\"\/><\/p>\n<p><img decoding=\"async\" width=\"440\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"3.3 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457473873\" data-creationdateformatted=\"10\/03\/2025 02:11 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675573-1759457473646.png\" data-modificationdate=\"null\" data-size=\"3283\" data-name=\"1759457473646.png\" data-id=\"18675573\" style=\"width: 652px; height: 40.0091px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675573-1759457473646.png\"\/><\/p>\n<h4><strong>Demo: PreferSameZone<\/strong><\/h4>\n<p dir=\"ltr\">Replace echo service definition spec so as to add\/patch visitors distribution: PreferSameNode<\/p>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"kubectl patch svc echo --type merge -p '{&quot;spec&quot;:{&quot;trafficDistribution&quot;:&quot;PreferSameZone&quot;}}'\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">kubectl patch svc echo --type merge -p '{\"spec\":{\"trafficDistribution\":\"PreferSameZone\"}}'<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<p dir=\"ltr\">Type consumer shell run script:hit.sh to generate visitors from consumer pod to echo service.<\/p>\n<p dir=\"ltr\"><span style=\"margin: 0px; padding: 0px;\"><strong>Habits<\/strong>: visitors ought to get routed to the pod residing in the identical zone (zone-a) because the consumer pod.<\/span><\/p>\n<p dir=\"ltr\"><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"21.9 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457595428\" data-creationdateformatted=\"10\/03\/2025 02:13 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675575-1759457595126.png\" data-modificationdate=\"null\" data-size=\"21863\" data-name=\"1759457595126.png\" data-id=\"18675575\" style=\"width: 788px; height: 78.5382px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675575-1759457595126.png\"\/><\/p>\n<p><img decoding=\"async\" width=\"423\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"3.4 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457606634\" data-creationdateformatted=\"10\/03\/2025 02:13 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675576-1759457606396.png\" data-modificationdate=\"null\" data-size=\"3375\" data-name=\"1759457606396.png\" data-id=\"18675576\" style=\"width: 760px; height: 25.1537px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675576-1759457606396.png\"\/><\/p>\n<p><img decoding=\"async\" width=\"440\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"3.3 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457615308\" data-creationdateformatted=\"10\/03\/2025 02:13 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675577-1759457615073.png\" data-modificationdate=\"null\" data-size=\"3283\" data-name=\"1759457615073.png\" data-id=\"18675577\" style=\"width: 764px; height: 46.8818px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675577-1759457615073.png\"\/><\/p>\n<h4><strong>Demo: Fallback<\/strong><\/h4>\n<p dir=\"ltr\">Drive all echo pods to zone-b, then check once more:<\/p>\n<div class=\"codeMirror-wrapper\" contenteditable=\"false\">\n<div contenteditable=\"false\">\n<div class=\"codeMirror-code--wrapper\" data-code=\"kubectl scale deploy echo --replicas=1&#10;kubectl patch deploy echo --type merge -p &#10;  '{&quot;spec&quot;:{&quot;template&quot;:{&quot;spec&quot;:{&quot;nodeSelector&quot;:{&quot;topology.kubernetes.io\/zone&quot;:&quot;zone-b&quot;}}}}}'&#10;kubectl rollout status deploy\/echo\" data-lang=\"text\/x-sh\">\n<pre><code lang=\"text\/x-sh\">kubectl scale deploy echo --replicas=1\nkubectl patch deploy echo --type merge -p \n  '{\"spec\":{\"template\":{\"spec\":{\"nodeSelector\":{\"topology.kubernetes.io\/zone\":\"zone-b\"}}}}}'\nkubectl rollout standing deploy\/echo<\/code><\/pre>\n<\/p><\/div><\/div>\n<\/div>\n<p><img decoding=\"async\" width=\"602\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"60.8 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457673409\" data-creationdateformatted=\"10\/03\/2025 02:14 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675579-1759457673080.png\" data-modificationdate=\"null\" data-size=\"60803\" data-name=\"1759457673080.png\" data-id=\"18675579\" style=\"width: 801px; height: 176.965px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675579-1759457673080.png\"\/><\/p>\n<p dir=\"ltr\">Type consumer shell run script:hit.sh to generate visitors from consumer pod to echo service.<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" width=\"449\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"14.2 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457724105\" data-creationdateformatted=\"10\/03\/2025 02:15 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675581-1759457723850.png\" data-modificationdate=\"null\" data-size=\"14152\" data-name=\"1759457723850.png\" data-id=\"18675581\" style=\"width: 657px; height: 109.744px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675581-1759457723850.png\"\/><\/p>\n<p dir=\"ltr\"><img decoding=\"async\" width=\"440\" class=\"fr-fic fr-dib fr-fil lazyload\" data-image=\"true\" data-new=\"false\" data-sizeformatted=\"3.3 kB\" data-mimetype=\"image\/png\" data-creationdate=\"1759457734287\" data-creationdateformatted=\"10\/03\/2025 02:15 AM\" data-type=\"temp\" data-url=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675582-1759457734009.png\" data-modificationdate=\"null\" data-size=\"3283\" data-name=\"1759457734009.png\" data-id=\"18675582\" style=\"width: 662px; height: 40.6227px;\" src=\"https:\/\/dz2cdn1.dzone.com\/storage\/temp\/18675582-1759457734009.png\"\/><\/p>\n<h3 dir=\"ltr\"><strong>End result Abstract<\/strong><\/h3>\n<div align=\"left\" dir=\"ltr\">\n<div class=\"table-responsive\" style=\"border: none;\">\n<table style=\"max-width: 100%; width: auto; table-layout: fixed; display: table;\" width=\"auto\">\n<thead>\n<tr style=\"overflow-wrap: break-word; width: auto;\" width=\"auto\">\n<th style=\"overflow-wrap: break-word; width: auto;\" width=\"auto\">coverage<\/th>\n<th style=\"overflow-wrap: break-word; width: auto;\" width=\"auto\">habits<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"overflow-wrap: break-word; width: auto;\" width=\"auto\">\n<td style=\"overflow-wrap: break-word; width: auto; background-color: rgb(255, 255, 255);\" width=\"auto\">\n<p dir=\"ltr\">Default<\/p>\n<\/td>\n<td style=\"overflow-wrap: break-word; width: auto; background-color: rgb(255, 255, 255);\" width=\"auto\">\n<p dir=\"ltr\">Site visitors distributed throughout all endpoints in round-robin trend.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"overflow-wrap: break-word; width: auto;\" width=\"auto\">\n<td style=\"overflow-wrap: break-word; width: auto; background-color: rgb(255, 255, 255);\" width=\"auto\">\n<p dir=\"ltr\">PreferSameNode<\/p>\n<\/td>\n<td style=\"overflow-wrap: break-word; width: auto; background-color: rgb(255, 255, 255);\" width=\"auto\">\n<p dir=\"ltr\">Prefers pods on the identical node, falls again if none accessible.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"overflow-wrap: break-word; width: auto;\" width=\"auto\">\n<td style=\"overflow-wrap: break-word; width: auto; background-color: rgb(255, 255, 255);\" width=\"auto\">\n<p dir=\"ltr\">PreferSameZone<\/p>\n<\/td>\n<td style=\"overflow-wrap: break-word; width: auto; background-color: rgb(255, 255, 255);\" width=\"auto\">\n<p dir=\"ltr\">Prefers pods in the identical zone, falls again if none accessible.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/div>\n<h2>Conclusion<\/h2>\n<p>Kubernetes launch v1.34 provides two small however impactful capabilities: PreferSameNode and PreferSameZone, these preferences helps builders and k8s operators to make visitors routing smarter, making certain visitors prioritizes native endpoints whereas sustaining resiliency with fallback mechanism.<\/p>\n<h3>References<\/h3>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes has steadily advanced into an trade commonplace for container orchestration, powering platforms from small developer clusters to hyperscale AI and knowledge infrastructures. Each new launch introduces options that not solely make workloads simpler to handle but additionally enhance efficiency, price effectivity, and resilience. With the v1.34 launch, one of many standout enhancements is the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":8566,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[5987,6342],"class_list":["post-8564","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-kubernetes","tag-v1-34"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/8564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8564"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/8564\/revisions"}],"predecessor-version":[{"id":8565,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/8564\/revisions\/8565"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/8566"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69d9690a190636c2e0989534. Config Timestamp: 2026-04-10 21:18:02 UTC, Cached Timestamp: 2026-05-15 15:31:19 UTC -->