Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release 1.25] Bump new kube-router version to fix issue when a port name is used #7458

Closed
rbrtbnfgl opened this issue May 9, 2023 · 1 comment
Assignees
Milestone

Comments

@rbrtbnfgl
Copy link
Contributor

Backport for #7446 #7391

@endawkins
Copy link

Validated on branch <branch_name> with commit <commit_id> / version

Environment Details

Infrastructure

  • Cloud
  • Hosted

Node(s) CPU architecture, OS, and Version:

Linux ip-172-31-42-72 5.15.0-1031-aws #35-Ubuntu SMP Fri Feb 10 02:07:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Cluster Configuration:

1 server

Config.yaml:

write-kubeconfig-mode: 644
token: test

Additional files

Copy and paste the following into a .sh file <filename>.sh: (I had to chmod 700 to run the script)

#!/bin/bash

# block one: 
    set -euo pipefail
    kubectl delete sts/wordpress || true
    kubectl delete deployment/busybox || true
    kubectl delete service/wordpress-service || true
    kubectl delete networkpolicy/wordpress-network-policy || true


# block two:
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: wordpress
spec:
  serviceName: wordpress-service
  replicas: 2
  selector:
    matchLabels:
      app: wordpress
  template:
    metadata:
      labels:
        app: wordpress
    spec:
      containers:
      - name: wordpress
        image: wordpress
        ports:
        - name: http
          containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: busybox
spec:
  selector:
    matchLabels:
      app: busybox
  template:
    metadata:
      labels:
        app: busybox
    spec:
      containers:
      - name: busybox
        image: busybox
        command:
        - sleep
        - infinity
---
apiVersion: v1
kind: Service
metadata:
  name: wordpress-service
spec:
  ports:
    - name: http
      port: 80
      targetPort: http
  clusterIP: None
  selector:
    app: wordpress
EOF

# block three:
kubectl rollout status sts/wordpress
kubectl rollout status deployment/busybox
! (
    kubectl exec -it deployment/busybox -- wget -O - wordpress-0.wordpress-service.default.svc.cluster.local >/dev/null || echo "failed"
    kubectl exec -it deployment/busybox -- wget -O - wordpress-1.wordpress-service.default.svc.cluster.local >/dev/null || echo "failed"
) | grep failed

# block four:
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: wordpress-network-policy
spec:
  podSelector:
    matchLabels:
      app: wordpress
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: busybox
    ports:
    - port: http
EOF

# block five:
sleep 30
! (
    kubectl exec -it deployment/busybox -- wget -O - wordpress-0.wordpress-service.default.svc.cluster.local >/dev/null || echo "failed"
    kubectl exec -it deployment/busybox -- wget -O - wordpress-1.wordpress-service.default.svc.cluster.local >/dev/null || echo "failed"
) | grep failed

Testing Steps

  1. Copy config.yaml
$ sudo mkdir -p /etc/rancher/k3s && sudo cp config.yaml /etc/rancher/k3s
  1. Install k3s
  2. Run the following script from the terminal: (make sure you chmod so that you can run the file)
./<filename>.sh

Replication Results:

  • k3s version used for replication:
k3s -v
k3s version v1.25.9+k3s1 (7502ce6a)
go version go1.19.8
output from script:

Error from server (NotFound): statefulsets.apps "wordpress" not found
Error from server (NotFound): deployments.apps "busybox" not found
Error from server (NotFound): services "wordpress-service" not found
Error from server (NotFound): networkpolicies.networking.k8s.io "wordpress-network-policy" not found
statefulset.apps/wordpress created
deployment.apps/busybox created
service/wordpress-service created
Waiting for 2 pods to be ready...
Waiting for 1 pods to be ready...
partitioned roll out complete: 2 new pods have been updated...
deployment "busybox" successfully rolled out
networkpolicy.networking.k8s.io/wordpress-network-policy created
command terminated with exit code 1
failed

Validation Results:

  • k3s version used for validation:
k3s -v
k3s version v1.25.9+k3s-3ce8dd17 (3ce8dd17)
go version go1.19.8
output:

statefulset.apps "wordpress" deleted
deployment.apps "busybox" deleted
service "wordpress-service" deleted
networkpolicy.networking.k8s.io "wordpress-network-policy" deleted
statefulset.apps/wordpress created
deployment.apps/busybox created
service/wordpress-service created
Waiting for 2 pods to be ready...
Waiting for 1 pods to be ready...
partitioned roll out complete: 2 new pods have been updated...
deployment "busybox" successfully rolled out
networkpolicy.networking.k8s.io/wordpress-network-policy created

Additional context / logs:

@github-project-automation github-project-automation bot moved this from To Test to Done Issue in K3s Development May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants