Describe POD
kubectl describe pod nodehelloworld.example.com
minikube service
MacBook:~/kubernetes-course$ cat first-app/helloworld-service.ymlapiVersion: v1kind: Servicemetadata:name: helloworld-servicespec:ports:- port: 80targetPort: nodejs-portprotocol: TCPselector:app: helloworldtype: LoadBalancerMacBook:~/kubernetes-course$ cat first-app/helloworld-nodeport-service.ymlapiVersion: v1kind: Servicemetadata:name: helloworld-servicespec:ports:- port: 31001nodePort: 31001targetPort: nodejs-portprotocol: TCPselector:app: helloworldtype: NodePortMacBook:~/kubernetes-course$ kubectl create -f first-app/helloworld-nodeport-service.ymlservice/helloworld-service createdMacBook:~/kubernetes-course$ minikube service helloworld-service --urlhttp://192.168.99.100:31001MacBook:~/kubernetes-course$ curl http://192.168.99.100:31001Hello World! |
Hello World!MacBook:~/kubernetes-course$ kubectl describe svc helloworld-serviceName: helloworld-serviceNamespace: defaultLabels: <none>Annotations: <none>Selector: app=helloworldType: NodePortIP: 10.107.169.35Port: <unset> 31001/TCPTargetPort: nodejs-port/TCPNodePort: <unset> 31001/TCPEndpoints: 172.17.0.5:3000Session Affinity: NoneExternal Traffic Policy: ClusterEvents: <none>MacBook:~/kubernetes-course$ kubectl get svc helloworld-serviceNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEhelloworld-service NodePort 10.107.169.35 <none> 31001:31001/TCP 3m14s |
pod-helloworld.yml
apiVersion: v1kind: Podmetadata:name: nodehelloworld.kubernetes.intelligence.wslabels:app: helloworldspec:containers:- name: docker-demoimage: joelgriffiths/docker-demoports:- containerPort: 3000 |
kubectl create -f pod-hellowworld.yml |
Useful commands
kubectl get pod
kubectl describe pod
kubectl expose pop <pod> –port=444 –name=frontend
kubectl port-forward <pod-name> 8080
kubectl attach <pod-name> -i
kubectl exec <pod-name> – command # First container
kubectl exec <pod-name> -c <container> – command
kubectl label pods <pod-name> mylabel=awesome
#SHELL
kubectl run -i –tty busybox –image=busybox –restart=Never – sh
POD Commands in hello world example
kubectl get pod
kubectl describe pod nodehelloworld.example.com
kubectl port-forward nodehelloworld.example.com 8081:3000
Getting to the POD directly
kubectl expose pod nodehelloworld.example.com –type=NodePort –name nodehelloworld-service
minikube service nodehelloworld-service –url
OR
MacBook:~/kubernetes-course$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 17h
nodehelloworld-service NodePort 10.111.245.197 <none> 3000:32129/TCP 4m
(See logs)
kubectl attach nodehelloworld.example.com
(Execute command)
kubectl exec nodehelloworld.example.com – ls /app
(Describe service)
kubectl get service
kubectl describe service nodehelloworld-service
Endpoints: 172.17.0.4:3000
(Start Busybox POD)
kubectl run -i –tty busybox –image=busybox –restart=Never — sh
#/ telnet 127.17.0.4:3000 ]]> http://gadgetwiz.com/kubernetes-on-digital-ocean/feed/ 0 http://gadgetwiz.com/warning-failedscheduling-default-scheduler-pod-has-unbound-immediate-persistentvolumeclaims/ http://gadgetwiz.com/warning-failedscheduling-default-scheduler-pod-has-unbound-immediate-persistentvolumeclaims/#respond Fri, 14 Jun 2019 15:38:20 +0000 http://www.gadgetwiz.com/?p=264 This means that you’re volumes aren’t ready for some reason.
MacBook:~/prod/digitalocean/zalaxy$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
mysql-storage Bound pvc-b878edbd-8d5a-11e9-a0d0-965c6120853a 5Gi RWO do-block-storage 41h
website-storage Pending do-block-storage 9m22s
website-www Pending do-block-storage 9m26s
MacBook:~/prod/digitalocean/zalaxy$ kubectl describe pvc website-storage
Name: website-storage
Namespace: zalaxy
StorageClass: do-block-storage
Status: Pending
Volume:
Labels:
Annotations: volume.beta.kubernetes.io/storage-provisioner: dobs.csi.digitalocean.com
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Events:
Type Reason Age From Message
—- —— —- —- ——-
Normal ExternalProvisioning 3m46s (x26 over 9m33s) persistentvolume-controller waiting for a volume to be created, either by external provisioner “dobs.csi.digitalocean.com” or manually created by system administrator
Mounted By: php-6d9fbfcbf4-t97sf
MacBook:~/prod/digitalocean/zalaxy$
