Changes between Version 2 and Version 3 of k8snetworking2023


Ignore:
Timestamp:
Dec 7, 2023, 7:41:30 AM (17 months ago)
Author:
deepthi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TabularUnified k8snetworking2023

    v2 v3  
    5959  - ippool
    6060}}}
     61
     62Apply the advertisement:
     63
     64`kubectl apply -f L2add.yaml`
     65
     66'''Step 3: Create a Service with a Virtual IP'''
     67
     68Let’s expose the wordpress application: Edit the service of type LoadBalancer on
     69wordpress-service.yaml:
     70
     71{{{
     72apiVersion: v1
     73kind: Service
     74metadata:
     75  name: wordpress
     76spec:
     77  selector:
     78    app: wordpress
     79  ports:
     80    - protocol: TCP
     81port: 80
     82      targetPort: 80
     83  type: LoadBalancer
     84}}}
     85
     86Save and apply it:
     87
     88`kubectl apply -f wordpress-service.yaml`
     89
     90Check the Service:
     91
     92kubectl get svc wordpress-service
     93
     943. MetalLB will assign an external IP from the defined range to your service.
     95
     96'''Step 4: Access the Service'''
     97
     98• You can now access the wordpress server using the external IP provided by MetalLB. This IP is accessible within your network.
     99
     100'''Troubleshoot'''
     101
     102On a different VM than the master do the testing for ARP advertisements.
     103
     104Remove MetalLB (Only for the reference)
     105
     106{{{
     107arp -a
     108ping 192.168.1.200
     109sudo apt install iputils-arping
     110arping 192.168.1.200
     111}}}
     112
     113Remove MetalLB (Only for the reference)
     114
     115{{{
     116kubectl delete -f
     117https://raw.githubusercontent.com/metallb/metallb/v0.13.12/con
     118fig/manifests/metallb-native.yaml
     119kubectl delete -f metallb-pool.yaml
     120kubectl delete -f L2add.yaml
     121kubectl get all -n metallb-system
     122}}}
     123
     124=== Kubernetes Ingress. (Optional) ===
     125
     126In a Kubernetes environment, if you want to use an Ingress resource to direct traffic to a service that's exposed via NodePort, while still allowing users to access the service using a standard port (like port 80) without specifying the NodePort, you can set it up as follows:
     127
     128'''Step 1: Expose Your Service Using NodePort'''
     129
     1301. Create a Service of Type NodePort for Your Web Application: Suppose you have a deployment named webapp. You'll need to create a service for it. Here's an example YAML for the service:
     131
     132{{{
     133apiVersion: v1
     134kind: Service
     135metadata:
     136  name: webapp-nodeport-service
     137spec:
     138  type: NodePort
     139  selector:
     140    app: webapp
     141  ports:
     142    - port: 80
     143      targetPort: 80
     144      protocol: TCP
     145}}}