kubectl delete pod <PODNAME> --grace-period=0 --force --namespace <NAMESPACE>
Helm + Git-Lab Runner
[user@host ~]# helm install --namespace=<<NAMESPACE>> gitlab-runner -f values.yaml gitlab/gitlab-runner
NAME: gitlab-runner
LAST DEPLOYED: Sun Mar 12 12:31:55 2023
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Your GitLab Runner should now be registered against the GitLab instance reachable at: "https://<<URL>>/"
Runner namespace "<<NAMESPACE>>" was found in runners.config template.
Create Kubernetes Service Account Token
kubectl create token <Service Account Name> to create the token.
https://kubernetes.io/docs/concepts/configuration/secret/#service-account-token-secrets
https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/
https://www.programmingwithwolfgang.com/use-the-tokenrequest-api-to-create-tokens-in-kubernetes/
CRUD v. HTTP Methods
Create -> Post
Read -> Get
Update -> Put
Delete -> Delete
Kubernetes API Overview
Kubernetes Authorization Modes
https://kubernetes.io/docs/reference/access-authn-authz/authorization/
4 Authorization Modes:
Node, ABAC, RBAC & Webhook
Kubernetes Controller Ingress
https://kubernetes.github.io/ingress-nginx/examples/rewrite/
Deployment¶
Rewriting can be controlled using the following annotations:
| Name | Description | Values |
|---|---|---|
| nginx.ingress.kubernetes.io/rewrite-target | Target URI where the traffic must be redirected | string |
Helm – Kubernetes
Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.
https://helm.sh/
https://github.com/helm/helm/releases
Install Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
Kubernetes – Rocky Linux
https://www.centlinux.com/2022/11/install-kubernetes-master-node-rocky-linux.html
CNI Plugin:
https://www.tkng.io/cni/flannel/
kubeadm init
kubeadm init --pod-network-cidr=10.244.0.0/16
Create file: /run/flannel/subnet.env
FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true
Testing Deployment
kubectl get pods --all-namespaces
kubectl run test --image=nginx
kubectl get pod -o wide
Flannel File Path:
/opt/cni/bin/flannel
Kubelet Logs:
journalctl -u kubelet
kubectl cluster-info
Useful Commands:
kubectl get pods –all-namespaces
kubectl run test –image=nginx
kubectl get pod -o wide
kubeadm
kubeadm reset
kubeadm init
kubeadm get node
kubeadm config images pull
kubeadm join –help | grep token
Kubernetes Deployment:
Create YAML File:
test-deployment.yaml
Apply/Create YAML file
kubectl apply -f test-deployment.yaml
Display Created Pods
kubectl get pod
kubectl get deployment
kubectl delete pod test 1 test 2
Display Service & Endpoints
kubectl get svc
kubectl describe svc service-name
kubectl get ep (endpoints)
POD DNS Resolution not working:
kubectl -n kube-system rollout restart deployment coredns
Fully Qualified Domain Name:
<servicename>.<namespace>.svc.cluster.local