Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

K8s traefik (ingess) Publishing Service-practice

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Traefik (ingess) Publishing Service of K8s

The previous article describes the installation and deployment of traefik as an ingress service based on K8s cluster, and briefly demonstrates the publishing service. This article will describe in detail how to publish the business service in conjunction with traefik.

Installation and deployment reference:

Https://blog.51cto.com/michaelkang/2429929

The version introduces traefik:v1.7k8s:v1.15.1 Rapid deployment traefik

If your K8s cluster has been deployed and you want to deploy traefik quickly, execute the command as follows:

Kubectl create-f https://raw.githubusercontent.com/containous/traefik/v1.7/examples/k8s/traefik-rbac.yamlkubectl create-f https://raw.githubusercontent.com/containous/traefik/v1.7/examples/k8s/traefik-ds.yaml executes successfully. In the browser data, you can see the management page of traefik at the IP address of a node node: port 8080. Start writing a business yaml file in practice

If you are not familiar with yaml, look here: https://blog.51cto.com/michaelkang/2429745

-# configure deploymentkind: DeploymentapiVersion: extensions/v1beta1metadata:# set dm name name: dm-pttest# add tag pttest labels: app: pttestspec:# declare through replicas the number of pod is 2 replicas: select controlled pod selector: matchLabels: app: pttest# define pod template: metadata:# in template and label pod app=pttest labels: app: pttestspec: Containers:# declares the container name Note that it is not a pod name, but the pod name should be defined in metadata-name: myapp image: ikubernetes/myapp:v1 ports:-containerPort: 80 Murmuri # Service configuration apiVersion: Service declare a Service resource object kind: Servicemetadata:#pod name name: svcpttest labels: app: pttest annotations:# check the error rate returned by the back-end service, which is greater than% 50 Kick out the cluster traefik.backend.circuitbreaker: "NetworkErrorRatio () > 0.5" spec: ports:-name: http port: 80 selector: app: pttest---# configuration ingressapiVersion: extensions/v1beta1kind: Ingressmetadata: name: myapp-traefik-ingress annotations: kubernetes.io/ingress.class: traefikspec: rules:-host: pttest.pt.com http: paths:-path: / # specify the backend service backend: ServiceName: svcpttest servicePort: 80 Verification Service # View Service [root@kubm-02 traefik] # kubectl get svc-o wideNAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGE SELECTORsvcpttest ClusterIP 10.245.148.114 80/TCP 2m12s app=pttest

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report