- set alias in powershell
set-alias -name k -value kubectl - Create pod manifest template
k run tellhost --image=toka9988/tellhost --dry-run=client -o yaml >mypod.yaml - Apply pod manifest file to create a pop
k apply -f mypod.yaml - Set up port-forward
k port-forward tellhost 8080tellhost is the pod name, the porxy will wait connect. Use another powershell terminal to test. - show pod log
k logs tellhost
stream the application log in real-time to see each request as it comes in
k logs tellhost -f--follow
k logs tellhost --timestamps=trueshow log time of each line - copy file between local PC and pods
k cp tellhost:\etc\hosts hosts.txt - Run command in Pod
k exec tellhost -- ps aux
k exec tellhost -it -- bash - delete pod by name
k delete pod tellhost3
k delete pod tellhost2 --wait=false - Creating an HTTP GET liveness probe
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: tellhost
name: tellhost
spec:
containers:
- image: toka9988/tellhost
name: tellhost
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 3
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
- Using a startup probe
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: tellhost
name: tellhost
spec:
containers:
- image: toka9988/tellhost
name: tellhost
ports:
- containerPort: 8080
startupProbe:
httpGet:
path: /
port: http
periodSeconds: 10
failureThreshold: 12
livenessProbe:
httpGet:
path: /
port: 8080
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 3
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}