Giter Site home page Giter Site logo

k3s-tutorial's Introduction

These notes are made mostly for myself, for didactical purposes. Pull requests are welcome.

Create a k3s cluster

...on Civo

civo k3s create test --remove-applications=traefik --nodes=1 --size=g2.xsmall --wait --save --switch

Traefik 2 is not supported on k3s; valid alternatives exist: k3s-io/k3s#817

...on VPS or bare metal

See: https://github.com/alexellis/k3sup

Deploy something on k3s

Preparation

Please be sure that your DNS is configured properly and install Helm.

Setup nginx

This step is required if Traefik has been removed.

helm repo add nginx-stable https://helm.nginx.com/stable
helm repo update
helm install nginx nginx-stable/nginx-ingress

Reference: https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-helm/#installing-the-chart

Deploy a service

References:

kubectl apply -f is-osm-uptodate.yaml

Test if the service is reachable over HTTP.

Setup SSL

kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.crds.yaml
kubectl create namespace cert-manager
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install \
  cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --version v0.14.1

References:

An alternative way to create a namespace is to apply the following YAML file:

apiVersion: v1
kind: Namespace
metadata:
  name: cert-manager

Setup letsencrypt

References:

kubectl apply -f letsencrypt-staging.yaml
kubectl apply -f letsencrypt.yaml

Use SSL

Uncomment the TLS section of is-osm-uptodate.yaml and the line referring to letsencrypt-staging, then update the deployment.

kubectl apply -f is-osm-uptodate.yaml

Try to connect over HTTPS and check if the fake certificate has been generated:

kubectl get secrets is-osm-uptodate-tls -o yaml | grep tls\.crt | awk '{ print $2 }' | base64 -d > cert
openssl x509 -in cert -text

Switch to the real letsencrypt certificate by commenting the line with letsencrypt-staging and uncommenting the following one, then update the deployment:

kubectl apply -f is-osm-uptodate.yaml

k3s-tutorial's People

Contributors

frafra avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.