Note: If you're following the example from the previous step, then continue to use the
conference-registration
namespace in all the YAML files and steps listed below (i.e. no changes required). Otherwise, change all references ofconference-registration
namespace and use your namespace instead.
For the first step, there are three options and you can choose one of them as per your preference.
-
Option 1: Register your domain through Cloudflare.
-
Option 2: Transfer your domain to Cloudflare.
-
Option 3: Register your domain through another domain name registrar and then add your domain to Cloudflare.
Note: Cloudflare also offers a free plan with CDN and Unmetered DDoS Protection for Layers 3-7 for personal or hobby projects that aren’t business-critical.
Your nameserver change may take up to 48 hours to propagate. Therefore, it would be best to wait for 48 hours before proceeding with the next step.
-
Log into the Cloudflare Dashboard and go to
User Profile
->API Tokens
or simply click here. From the API Token home screen selectCreate Token
. Then, underCustom token
, selectGet Started
.Note: You need to generate an API token and not an API key.
-
To generate the token, make sure the token has
Zone: Read
andDNS: Edit
permissions for all zones. Optionally you can exclude certain zones. Then selectContinue to summary
.Note: You need to Include
All zones
in theZone Resources
section. SettingSpecific zone
won't work. However, you can still add one or more Excludes. -
In the next screen, select
Create Token
. -
The generated token is displayed in the next screen as shown below. Copy and keep it safe as it won't be shown again.
-
Then, Base64 encode the token using the echo command shown below. For example, if the generated token is
1234567890123456
, then the Base64 encoded value of it would beMTIzNDU2Nzg5MDEyMzQ1Njc4OQ==
.echo -n '1234567890123456789' | base64
-
Use the Base64 encoded token from the above step to update the value of the resource with
data.CLOUDFLARE_API_TOKEN
in the./cloudflare/k8s/secret.yaml
file. -
Create the
cloudflare-credentials
Kubernetes Secret in theconference-registration
namespace.kubectl apply -f ./cloudflare/k8s/secret.yaml
Note: Fore more details, refer to the Cloudflare DNS Provider documentation.
If you get a permission error communicating with Cloudflare, ensure that the domain name being registered does not exceed the limits of your plan. Hierarchical domains are not supported on the free plan as of this writing.
-
Replace
app.your-domain.com
in the./cloudflare/k8s/dns-provider.yaml
file with your desired domain. -
Create the
cloudflare
DNS Provider resource in theconference-registration
namespace.kubectl apply -f ./cloudflare/k8s/dns-provider.yaml
In the Kyma console, select the conference-registration
namespace. Then, go to Configuration
-> DNS Providers
and enter the following values. Select your namespace and for Secret Name
select the Secret that you created in the previous step. For Include Domains
use your domain instead of app.your-domain.com
. Then, click Create
.
Wait for the status of the DNS Provider
to change to READY
before proceeding with the next step.
In the Kyma console, select the conference-registration
namespace. Then, go to Configuration
-> DNS Entries
. Use your domain instead of app.your-domain.com
. Under Targets
, select both the options from the dropdown to add both the istio-ingressgateway
and vpn-shoot
records as the Targets. Then, click Create
.
Wait for the status of the DNS Entry
to change to READY
before proceeding with the next step.
- Check to ensure that the
DNS Provider
created in the previous step has aREADY
status. - Confirm that the API Token added to the Kubernetes Secret created in the
Create a Kubernetes Secret
step above has the required access to add DNS records to your domain name registrar's account. - Log into the Cloudflare Dashboard and go to
Websites
-> Select your account and domain ->DNS
and verify that the common records of your domain name are displayed there. If there are no records there, then your nameserver change may not have propagated and you would need to wait for up to 48 hours for them to be displayed.
Create an Issuer in the istio-system
namespace.
Note: This example uses Let's Encrypt. You can use any other ACME server to create the Issuer. You can also use a Certificate Authority (CA) instead.
-
Replace
[email protected]
andapp.your-domain.com
in the./cloudflare/k8s/issuer.yaml
file with your desired email and domain, which will be used for registration to the Issuer. -
Create the
Issuer
resource in theconference-registration
namespace.kubectl apply -f ./cloudflare/k8s/issuer.yaml
-
Select
Preferences
from the top-right corner of the Kyma console. -
Select
Clusters
and enableShow hidden Namespaces
. -
Select the
istio-system
namespace in the top-right corner of the Kyma console. -
Go to
Configuration
->Issuers
. SelectCreate Issuer
and enter the following values. Use your email instead of[email protected]
and use your domain instead ofapp.your-domain.com
. Then, selectCreate
.
After the Issuer has been created, you can use it to create a Certificate in the istio-system
namespace.
-
Replace
app.your-domain.com
in the./cloudflare/k8s/certificate.yaml
file with your desired domain. -
Create the
Certificate
resource in theistio-system
namespace.kubectl apply -f ./cloudflare/k8s/certificate.yaml
-
Select the
istio-system
namespace in the top-right corner of the Kyma console. -
Go to
Configuration
->Certificates
. SelectCreate Certificate
and select theAdvanced
tab. Then, enter the following values. ForCommon Name
enter your primary domain name instead ofapp.your-domain.com
. ForIssuer Namespace
selectistio-system
and forIssuer Name
select the Issuer created in the previous step. Then, clickCreate
. -
Wait for the status of the Certificate to change to
ready
, after which you can create an Istio Gateway using the Certificate.
After the Certificate has been created, you can use it to create the Istio Ingress Gateway in the conference-registration
namespace.
-
Replace
letsencrypt-cert-9t54f
in the./cloudflare/k8s/ingressgateway.yaml
file with theSecret
that was generated in theistio-system
namespace for theletsencrypt-cert
Certificate created in the previous step.Note: The name of the Secret starts with
letsencrypt-cert-
and end with a random text. -
Replace all instances of
app.your-domain.com
with your domain name in the./cloudflare/k8s/ingressgateway.yaml
file. -
Create the
Istio Ingress Gateway
resource in theconference-registration
namespace.kubectl apply -f ./cloudflare/k8s/ingressgateway.yaml
-
Select the
conference-registration
namespace in the top-right corner of the Kyma console. -
Go to
Istio
->Gateways
and SelectCreate Gateway
. Click on theAdvanced
tab. Then, selectAdd Server
and expand theServers
section. -
Select
Server 1
. -
Select its protocol as
HTTPS
and give it a name as shown below. -
Select the
TLS Mode
asSIMPLE
. ForCredential Name
select theSecret
that was generated in theistio-system
namespace for theletsencrypt-cert
Certificate created in the previous step. Then, add your domain to theHosts
field.Note: The name of the Secret starts with
letsencrypt-cert-
and end with a random text. -
Under the other
Server
section, select theProtocol
asHTTP
and give it a name as shown below. Then, add your domain to theHosts
field. -
Then, click on the
YAML
tab at the top, and enterhttpsRedirect: true
undertls
within the server withHTTP
protocol as shown below. Then, selectCreate
.tls: httpsRedirect: true
Create an API Rule to expose your web app running on Kyma Runtime.
After the Istio Gateway has been created, you can use it to create the API Rule in the conference-registration
namespace.
-
Make the following changes in the
./cloudflare/k8s/api-rule.yaml
file:-
Change the value of the host from
app.your-domain.com
to your domain. -
Then, change all instances of
app-your-domain-com
to any desired name.
-
-
Create the
API Rule
resource in theconference-registration
namespace.kubectl apply -f ./cloudflare/k8s/api-rule.yaml
-
Select the
conference-registration
namespace in the top-right corner of the Kyma console. -
Go to
Discovery and Network
->API Rules
and SelectCreate API Rule
. Then, enter the following values. Use your domain instead ofapp.your-domain.com
and use any desired name instead ofapp-your-domain-com
. Then, selectCreate
.
-
Go to your Cloudflare dashboard.
-
Select your domain and go to
SSL/TLS
->Overview
. Then, selectFull (strict)
. -
Next, go to
SSL/TLS
->Edge Certificates
. Then, enableAlways Use HTTPS
if you want all visitors to go to the secure version of your site.
🏠 |
---|