DEV Community

Galina Melnik
Galina Melnik

Posted on

2 2

Migrate C# project to Istio

My team has a C# project. This project is deployed using k8s. There was a task to migrate to corpotive Istio using a certificate, a gateways and a virtual service but without a service mesh.
If you have such type of a task there are my recomendations:

  1. It's needed to create a file with a certificate:
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  labels:
    istio-certificate: "true"            # if it would be used with gateway object, the value should be set to "true"
    app.kubernetes.io/managed-by: {{ .Release.Service }}
  name: {{ .Values.environment.servicename }}
spec:
  dnsNames:
  - {{ .Values.service.name }}.{{ .Release.Namespace }}.{{ .Values.environment.cluster }}
  issuerRef:
    kind: ClusterIssuer
    name: certificates-issuer
  secretName: {{ .Values.environment.servicename }} # the secretName should be equals to the certificate name
Enter fullscreen mode Exit fullscreen mode

If you want to learn more about certificate resources, there is pretty documentaions here
The second thing is needed to do is to add a gateway description.
The istio gateway provides a description of ports & protocols which will be used. More information here

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: {{ .Values.service.name }}
spec:
  selector:
    company/istio-ingressgateway: common
  servers:
    - port:
        number: 443                                       
        name: https
        protocol: HTTPS                                   
      tls:
        mode: SIMPLE                                      
        credentialName: {{ .Values.environment.servicename }} 
      hosts:
        - {{ .Values.service.name }}.{{ .Release.Namespace }}.{{ .Values.environment.cluster }}               # use a correct hostname for your namespace 
Enter fullscreen mode Exit fullscreen mode

Istio VirtualService describes routing. It's needed to specify hosts, ports and other things. All documentation available here

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: {{ .Values.service.name }}
spec:
  hosts:
    - {{ .Values.service.name }}.{{ .Release.Namespace }}.{{ .Values.environment.cluster }}
  gateways:
    - {{ .Values.service.name }}                        # join the virtualService with the gateway
  http:
  - name: "default"
    route:
    - destination:
        port:
          number: {{ .Values.environment.serviceport }}       
        host: {{ .Values.environment.servicename }}-service
Enter fullscreen mode Exit fullscreen mode

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay