<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: guangyuan zhang</title>
    <description>The latest articles on DEV Community by guangyuan zhang (@guangyuan_zhang_c508769d0).</description>
    <link>https://dev.to/guangyuan_zhang_c508769d0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2498228%2F603dc3d6-c95e-4c0d-9e50-1ccc63c2a1c5.png</url>
      <title>DEV Community: guangyuan zhang</title>
      <link>https://dev.to/guangyuan_zhang_c508769d0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/guangyuan_zhang_c508769d0"/>
    <language>en</language>
    <item>
      <title>Elastic Cloud on Kubernetes (ECK) with custom domain name</title>
      <dc:creator>guangyuan zhang</dc:creator>
      <pubDate>Tue, 03 Dec 2024 14:57:12 +0000</pubDate>
      <link>https://dev.to/guangyuan_zhang_c508769d0/elastic-cloud-on-kubernetes-eck-with-custom-domain-name-4o3k</link>
      <guid>https://dev.to/guangyuan_zhang_c508769d0/elastic-cloud-on-kubernetes-eck-with-custom-domain-name-4o3k</guid>
      <description>&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Domain Name: You need a domain name (e.g., example.com) and access to its DNS settings.&lt;/li&gt;
&lt;li&gt;TLS Certificate: A valid TLS certificate for the custom domain. You can use Let's Encrypt or any other certificate authority (CA).&lt;/li&gt;
&lt;li&gt;Running ECK Cluster: An Elasticsearch cluster deployed and managed by ECK.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Provision TLS Certificates
&lt;/h2&gt;

&lt;p&gt;Use Cert-Manager for automatic TLS certificate provisioning.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Installation
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml
or
helm repo add jetstack https://charts.jetstack.io --force-update
helm install \
  cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace \
  --version v1.16.2 \
  --set crds.enabled=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Configuring issuers
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: admin@example.com #Update email with your contact email address.
    privateKeySecretRef:
      name: letsencrypt-prod
    solvers:
    - http01:
        ingress:
          class: nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Update DNS Records&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Obtain the &lt;a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="noopener noreferrer"&gt;ingress controller&lt;/a&gt;'s external IP:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get svc -n ingress-nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add a DNS record in your domain's control panel:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Type: A/CNAME
Name: es.example.com
Value: &amp;lt;Ingress Controller External IP&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With Elastic Cloud on Kubernetes (ECK) you can extend the basic Kubernetes orchestration capabilities to easily deploy, secure, upgrade your Elasticsearch cluster, and much more.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install custom resource definitions:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create -f https://download.elastic.co/downloads/eck/2.15.0/crds.yaml`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install the operator with its RBAC rules:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://download.elastic.co/downloads/eck/2.15.0/operator.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Configure Ingress
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f - &amp;lt;&amp;lt;EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: eck
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  ingressClassName: nginx
  tls:
    - secretName: eck-tls
      hosts:
        - es.example.com
        - kb.example.com
  rules:
    - host: es.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: quickstart-es-http
                port:
                  number: 9200
    - host: kb.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: quickstart-kb-http
                port:
                  number: 5601
EOF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we customize the configuration &lt;code&gt;spec.http&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      selfSignedCertificate:
        disabled: true
      certificate:
        secretName: eck-tls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Disable the self signed certificate, and use the certificate requested from letencrypt by ingress which shows below⬇️.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Deploy an Elasticsearch cluster and a Kibana instance
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f - &amp;lt;&amp;lt;EOF
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: 8.16.1
  http:
    tls:
      selfSignedCertificate:
        disabled: true
      certificate:
        secretName: eck-tls
  nodeSets:
    - name: default
      count: 3
      config:
        node.store.allow_mmap: false
---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: quickstart
spec:
  version: 8.16.1
  count: 1
  elasticsearchRef:
    name: quickstart
  http:
    tls:
      selfSignedCertificate:
        disabled: true
      certificate:
        secretName: eck-tls
EOF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cert-manager.io/cluster-issuer: "letsencrypt-prod"&lt;/code&gt; annotation tells the ingress to use the &lt;code&gt;letsencrypt-prod&lt;/code&gt; cluster issuer for certificate requests. Cluster issuer has declared above.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"&lt;/code&gt; annotation is very &lt;strong&gt;&lt;em&gt;important&lt;/em&gt;&lt;/strong&gt;, for elasticsearch and kibanan are using https.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then you can visit elasticsearch/kibana via your own domain&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>elasticsearch</category>
      <category>eck</category>
      <category>ingress</category>
    </item>
  </channel>
</rss>
