Giter Site home page Giter Site logo

Comments (4)

kurokobo avatar kurokobo commented on August 24, 2024

@everydaylearner
Hi, thanks for using my guide :)

Where can i change the port number? say i want to run on port 8443 rather than default port 80?

You mean, your AWX is already accesible via HTTP over 80 and HTTPS over 443, but you want to use HTTPS over 8443 instead, right?

from awx-on-k3s.

everydaylearner avatar everydaylearner commented on August 24, 2024

yes correct, i want to run over 8443

Thank you!

from awx-on-k3s.

kurokobo avatar kurokobo commented on August 24, 2024

Okay, so you should to know the port 8443 on your K3s host is already used by Traefik by default, to route HTTPS traffic internally.

$ kubectl -n kube-system get deployment traefik -o=jsonpath='{.spec.template.spec.containers[0].ports}' | jq
...
  {
    "containerPort": 8443,
    "hostPort": 8443,     👈👈👈
    "name": "websecure",
    "protocol": "TCP"
  }
...

Traefik has the feature called EntryPoints to expose custom ports, but 8443 can't be used due to this confliction.

So, there are two way to achieve your requirements.

  1. Expose 8443 that Traefik uses internally to the host network.
  2. Change internal port for Traefik from 8443, and then create custom EntryPoints.

The method 1 is a bit dirty and un-secure since unintended ports such as 8000, 9000, 9100 will also be exposed, but simple.

# Create custom configuration file for Traefik
sudo tee /var/lib/rancher/k3s/server/manifests/traefik-config.yaml <<EOF
---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: traefik
  namespace: kube-system
spec:
  valuesContent: |-
    hostNetwork: true
EOF

# Then wait until your traefik by the following command is 1/1 READY.
kubectl -n kube-system get deployment traefik

Now your 8443 is accessible via HTTPS

Method 2 is a bit complicated and there might be some side effects.

# Create custom configuration file for Traefik
sudo tee /var/lib/rancher/k3s/server/manifests/traefik-config.yaml <<EOF
---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: traefik
  namespace: kube-system
spec:
  valuesContent: |-
    ports:
      websecure:
        port: 8442
        expose: true
        exposedPort: 443
        protocol: TCP
        tls:
          enabled: true
      mywebsecure:
        port: 8443
        expose: true
        exposedPort: 8443
        protocol: TCP
        tls:
          enabled: true
    entryPoints:
      mywebsecure:
        address: ":8443"
EOF

# Then wait until your traefik by the following command is 1/1 READY.
kubectl -n kube-system get deployment traefik

from awx-on-k3s.

everydaylearner avatar everydaylearner commented on August 24, 2024

thank you very much! Appreciate it! It helps to understand better. I think i need to read more on traefik.

from awx-on-k3s.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.