Skip to content

origoss/local-k8s-project

Repository files navigation

Local Kubernetes environment

Create Kubernetes environment

Options:

  • Microk8s
  • K3s
  • Minikube
  • Minishift
  • Kind

Checking the kubeconfig:

echo $KUBECONFIG

Kind config:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP

To create a new cluster:

kind create cluster --name local-test --config kind-config.yaml
kubectl cluster-info --context kind-local-test

Destroy Kubernetes environment

kind delete cluster --name kind-local-test

Deploying Ingress controller

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

Deploying cert-manager

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.3/cert-manager.yaml

Deploying root CA certificate

apiVersion: v1
data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJaVENDQVF1Z0F3SUJBZ0lSQU1NdHZXZHNSRVdQUDEyYUxDU3VSRG93Q2dZSUtvWkl6ajBFQXdJd0VqRVEKTUE0R0ExVUVBeE1IY205dmRDMWpZVEFlRncweU5EQTVNalV4TkRFNU1qaGFGdzB5TkRFeU1qUXhOREU1TWpoYQpNQkl4RURBT0JnTlZCQU1UQjNKdmIzUXRZMkV3V1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVM1CkNkR2hWRmQrTUM5aWo0dkRHZ1EzS0hlVHN2ek1wN1doaHFYNS9rQllaQnlNVDJuVjF6c1BEZ3B1eDdGekFmdGYKRkNRVzhzbEtZc2RwZzg3eFFwQUdvMEl3UURBT0JnTlZIUThCQWY4RUJBTUNBcVF3RHdZRFZSMFRBUUgvQkFVdwpBd0VCL3pBZEJnTlZIUTRFRmdRVXlZMTd6NkY5c01LZEJ1TDN1a2tiMkQ1ZlZSUXdDZ1lJS29aSXpqMEVBd0lEClNBQXdSUUloQUtOTTZMMmlZLzNuUFFGL0Z6ZnRWcVMrS1J1TlBYbTVoY1ZDRmcxYlZxTGtBaUFiWCs3dVNML0sKOXFtS1dtdWQvRnd1QThmQVhXaVM1R0tVckZPTHZ4QklpUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
  tls.key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUp0REU4UFFIRk9VVkpGSnk4Zis2RU1ieUQ4YlY2b3BRRGZFUi8rQjhGd0JvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFdVFuUm9WUlhmakF2WW8rTHd4b0VOeWgzazdMOHpLZTFvWWFsK2Y1QVdHUWNqRTlwMWRjNwpEdzRLYnNleGN3SDdYeFFrRnZMSlNtTEhhWVBPOFVLUUJnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
kind: Secret
metadata:
  name: root-ca
type: kubernetes.io/tls
kubectl apply -f root-ca-cert-secret.yaml -n argocd

Creating CA issuer

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: selfsigned-cluster-issuer
spec:
  ca:
    secretName: root-ca
kubectl apply -f ca-issuer.yaml -n argocd

Deploying ArgoCD

Options:

  • kubectl apply -f
  • kustomize
  • Helm
  • Helmfile

With kustomize

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: argocd
resources:
- https://raw.githubusercontent.com/argoproj/argo-cd/v2.7.2/manifests/install.yaml
- namespace.yaml
- ingress.yaml

To diff the output:

kustomize build argocd/base | kubectl diff -f -

To perform the deployment:

kustomize build argocd/base | kubectl apply -f -

Deploying Prometheus Operator

Options:

  • kubectl apply -f from yaml
  • helm install
  • helmfile
  • ArgoCD + one of above

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published