Kubernetes: mudanças entre as edições
Ir para navegação
Ir para pesquisar
Linha 42: | Linha 42: | ||
<pre> | <pre> | ||
kubectl exec -it podname -n namespace -- bash | kubectl exec -it podname -n namespace -- bash | ||
</pre> | </pre> | ||
Edição das 16h42min de 26 de outubro de 2020
Links
- https://kubernetes.io/
- kubectl Cheat Sheet
- https://training.play-with-kubernetes.com/
- https://labs.play-with-k8s.com/
- Kubernetes Failure Stories
- https://crossplane.io/
- Matchbox Kubernetes network boot
- Debugging network stalls on Kubernetes
- https://kubernetes.io/docs/home/
Certification
- https://www.cncf.io/certification/expert/cka/
- https://kubernetes.io/docs/tasks/
- https://github.com/arush-sal/cka-practice-environment
- https://github.com/kelseyhightower/kubernetes-the-hard-way
- https://jvns.ca/blog/2017/08/05/how-kubernetes-certificates-work/
Create a Cluster
Cloud Provider
VMWARE
- vSphere Cloud Provider
- Configuring vSphere Volumes for Kubernetes
- PersistentVolume Storage Options on vSphere
- vSAN as Persistent Storage for a Kubernetes Cluster
- Deploying a Kubernetes Cluster on vSphere with CSI and CPI
- Dynamic Provisioning and StorageClass API
- LAB GUIDE - KUBERNETES AND STORAGE WITH THE VSPHERE CLOUD PROVIDER - STEP BY STEP
Basic Commands
List
kubectl get pods --all-namespaces
kubectl get namespaces
Remote execution/console login
kubectl exec -it podname -n namespace -- bash
Scale
kubectl scale --replicas=3 deployment/foo
Host Affinity
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- cluster-nodepoolname-vmisntance00.domain
- cluster-nodepoolname-vmisntance01.domain
- cluster-nodepoolname-vmisntance02.domain
- cluster-nodepoolname-vmisntance03.domain
By agentpool
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: agentpool
operator: In
values:
- ssd
PODs
Port Forward
kubectl port-forward pod/kuard2 8000:8080
Node afinity
spec
.
.
.
strategy:
.
.
.
template:
metadata:
.
.
.
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: agentpool
operator: In
values:
- svc01
- svc02
CronJob
kubectl create job --from=cronjob/<name of cronjob> <name of job> kubectl create job --from=cronjob/pgdump pgdump-manual-001
Network
Ingress
- https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md
- https://docs.microsoft.com/pt-br/azure/aks/ingress-static-ip
Access pod by hostname
FQDN:
auto-generated-name.my-svc.my-namespace.svc.cluster.local
LoadBalance
Persistent Storage
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: task-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
kind: PersistentVolume
apiVersion: v1
metadata:
name: task-pv-storage
labels:
type: local
spec:
storageClassName: managed-standard
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
kubectl get pv task-pv-storage
kind: Pod
apiVersion: v1
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-storage
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage